0

Set Choice Value

Hello,

I am creating a button to set a value of Box1 to 'Active' (id1).

How do I set the choice value of clicking the button instead of:

Box1 := 1

I tried:

Box1 := text("Active")
Box1 := "Active:

 

Any help would be appreciated!

 

S Moore

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • John Halls
    • John_Halls
    • 10 mths ago
    • Reported - view

    Hi

    I don't think there is a function to give a list of choices available for a choice field, and then find the id based on its text value. I would think this is because choice fields are designed to be set by id. If you really have to set it by text value I have written a loop that sets it to each of the ids in turn until the text value is the one you are looking for, thus

    for a from 1 to 10 do
        Choice := a;
        if text(Choice) = "Active" then
            a := 10
        end
    end
    

    I wouldn't recommend using it though!

    Regards John

    Like
    • S Moore
    • SMoore
    • 10 mths ago
    • Reported - view

    Thanks, John! 

     

    I didn't realize Ninox didn't develop such a simple function. The loop would work, but it's creating entirely more work than I want!

     

    I figured it would be easier to read the code with Field := text("Value") instead of Field := 1, then I wouldn't have to trace the ID back.

     

    Oh well, perhaps in a future development!

     

    Thanks for answering my question.

    S Moore

    Like
Like Follow
  • Status Answered
  • 10 mths agoLast active
  • 2Replies
  • 142Views
  • 2 Following