0

How to reference choices in a formula when the choices have no text

I'm trying to make the choices displayed in field A depend on the choices selected in field B. But I want the choices in field A to be icons with no text. How do I fill the blank in the formula:

if 'B' = "choice2" then A = "[?]" else A = "[?]" end

15 replies

null
    • David
    • 5 yrs ago
    • Reported - view

    Hello - anybody seen this? Still needing an answer if you can find one! Thanks. 

    • blackie
    • 5 yrs ago
    • Reported - view

    each choice should have a number value, such as 1, 2, 3 ect... You can use those values.

    • blackie
    • 5 yrs ago
    • Reported - view

    Then use the styled function, with the text as a space 

    styled(text, bgColor, color, icon)

    • Sean
    • 5 yrs ago
    • Reported - view
    • David
    • 5 yrs ago
    • Reported - view

    slowwagon, I think the difference is I'm trying to make the choices shown in one choice field dependent on the choices shown in another choice field. blackie, I'm a newcomer to Ninox's script, so still figuring out how the syntax works! 

    • Sean
    • 5 yrs ago
    • Reported - view

    Still trying to understand. Do you mean...

    if 'Choice B' = 1

    Choices for A := A, B, C

    else if 'Choice B' = 2

    Choices for A := X, Y, Z

    etc.

    • David
    • 5 yrs ago
    • Reported - view

    Sorry for being vague, and thanks for folliwing up.

    Final goal here is to have several columns in my table that consist ONLY of icons. They act as indicators for stages reached in different editing processes. Each process is governed by a choice field where the choices are stages in the process. When the last choice is selected, I want a connected icon column to show, let's say, icon A. Otherwise it shows icon B.

    The idea is to pack a log of information into the table without having to include the governing choice fields. I'm assuming that the icon field is also a choice field, hence the selection in the governing field would trigger the selection in the icon field.

    I've used a formula to connect two choice fields where the choices in both cases are written text. I can't make it work where the triggered field contains an icon but not text. It's probably really simple, but there isn't enough documentation on the Ninox website to figure out how the formulas work in situations like this. Or maybe I'm just missing something! 

    • Sean
    • 5 yrs ago
    • Reported - view

    I’m not ignoring your post. Just in the middle of a project.

    • blackie
    • 5 yrs ago
    • Reported - view

    I would make the icon only field a formula, not a choice.

    Then use a script similar to this:

     

    if Choice = 1 then
    styled("", "", "warn")
    else
    styled("", "", "check")
    end

    • Sean
    • 5 yrs ago
    • Reported - view

    I agree with @blackie. Also, you can set up a view that shows only the icon fields and when you select a record to edit it will show the the governing fields so you can change the status.

    Are you using the Ninox icons or custom icons?

    • David
    • 5 yrs ago
    • Reported - view

    Many thanks. But when I adapt that formula, it returns an error. What does the "","", string refer to? Also, there seems no way to identify the names of the icons as the link provided only lets you download an unopenable .ninox file. Think I need to spend a day learning the Ninox script!

    • blackie
    • 5 yrs ago
    • Reported - view

    styled(text, colour, icon) - creates styled text elements. The icon is placed to the left of the text. Use "" for none, and the colour is the objects background
    |  styled("Attention", "red", "warn")

    • blackie
    • 5 yrs ago
    • Reported - view

    What kind of error?

     

    This is a list of the icons

    add-to-cart
    apple
    appstore
    arrow-e
    arrow-n
    arrow-ne
    arrow-nw
    arrow-s
    arrow-se
    arrow-sw
    arrow-w
    arrow1
    arrow2
    arrow3
    arrow4
    arrow5
    arrow6
    arrow7
    arrow8
    astounded
    at
    attachment
    ball-0
    ball-100
    ball-25
    ball-50
    ball-75
    balloon
    banana
    banknotes
    barchart
    basketball
    battery
    bell
    bike
    binoculars
    bird
    book
    bookmark
    books
    brain
    burger
    butterfly
    calculate
    calendar
    calendar2
    calendar3
    call-accept
    call-end
    camera
    cancer
    car
    cardgame
    cart
    cart2
    cat
    check
    checklist
    checklist2
    cherry
    chicken
    clock
    coffee
    cool
    creditcard
    crying
    cube
    delivery
    dialog
    digger
    disclosed
    discussion
    display
    document
    dog
    done
    download
    dropbox
    elephant
    emergency
    evil
    face
    face-idea
    face2
    facebook
    factory
    filter
    fish
    fish2
    flap
    folder
    folder-burning
    folder-documents
    folder-downloads
    folder-heart
    folder-music
    folder-people
    folder-pictures
    folder-tile
    folder-world
    football
    forbidden
    forklift
    gamepad
    gear
    get-money
    glider
    go
    goal
    google
    googleplus
    graduate
    grocery
    guitar
    hammer
    happy
    headset
    heart
    heartbeat
    highheel
    holiday
    home
    horse
    html
    idea
    info
    instagram
    instrument
    irritated
    iso
    joking
    key
    key2
    landscape
    letter
    light
    linked
    linkedin
    list
    location
    lock
    lock2
    loughing
    loving
    lunges
    mailbox
    man
    man2
    man3
    megaphone
    messenger
    microphone
    money
    moneybag
    movie
    music
    note
    option
    palette
    pause
    pay-card
    pay-money
    paypal
    pencil
    pencil-ruler
    people
    percent
    percent0
    percent100
    percent25
    percent50
    percent75
    person
    person-paper
    phone
    phone2
    photos
    piechart
    pig
    pizza
    plane
    plant
    plate
    play
    play2
    playstation
    point-down
    point-left
    point-up
    power
    present
    printer
    qna
    question
    question2
    question3
    quote
    rack
    raspberry
    rec
    record
    recycle
    reel
    reload
    robot
    running
    sad
    sdcard
    shake-hands
    shirt
    shoe
    shot
    sign
    silent
    smartphone
    smile-astonished
    smile-blink
    smile-happy
    smile-not-amused
    smile-unhappy
    sound
    speaker
    star
    star2
    stop
    stop2
    stroke
    sun
    tennis
    tentacle
    thumb-down
    thumb-up
    tie
    tools
    trash
    truck
    tube
    twitter
    umbrella
    unhappy
    video
    warn
    warn2
    waterdrop
    whine-cheese
    woman1
    world
    x
    yinyang
    youtube

    • David
    • 5 yrs ago
    • Reported - view

    Ah, that fixes it. Great. Thanks - and thanks for the list of icons.

    BTW, how does Ninox script handle multiple "ifs"?  If A then X, if B then Y, else Z.

    • blackie
    • 5 yrs ago
    • Reported - view

    Ninox can handle nesting if statements.

     

    but sometimes it is easier to use a switch statement. Nesting too many if statements can get confusing if you can do the same thing with switch.

Content aside

  • 5 yrs agoLast active
  • 15Replies
  • 6257Views