Quantcast
Channel: Value Lists Latest Topics
Viewing all articles
Browse latest Browse all 217

Creating a value list from two fields in the same table

$
0
0

I want to do something seemingly straightforward, but it seems very hard to accomplish. I have two global text fields that a user sets in a table TGlobal. At some point, I want the user to choose between the text values in the two fields, FieldOption1 and FieldOption2, which represent different options that a user can take at some point in the workflow. So ideally I'd like to create a value list, which can be used to present a user with the two clear choices in an elegant layout that contains a question and a radio button.

So here's what I have tried to do.

1. I created a table, VList, with two fields (ValueOptionID and ValueOption) and two records. The first record has ValueOptionID 1, the second ValueOption 2. I set up a calculation field for ValueOption. The calculation is a Case statement with the following straightforward logic: if ValueOptionID is 1, ValueOption is TGlobal::FieldOption1, and if ValueOptionID is 2, ValueOption is TGlobal::FieldOption2.

Then I tried to create a Value List using values from a field. I used values from the field ValueOptionID and displayed them from the field ValueOption. In principle, the user sees understandable text, but the script knows which field the user has chosen (depending on whether the result is 1 or 2) and can proceed accordingly.

Except that Value Lists can't use calculation fields, at least for the second value.

2. So I tried making ValueOption a text field rather than a calculation, but I auto-entered a calculated value using the exact same case statement as above. The only problem is that if the user were to change the value of TGlobal:FieldOption1 or TGlobal:FieldOption2, the corresponding value of VList::ValueOption wouldn't change for either record because no other field in the two records has changed. 

Is there a way to make this work? Am I making it too complicated? Or do I have to make it more complicated still? I have been away from coding in FM for some time and so am rusty.

(I know that some responders prefer a concrete description of the problem, and I can supply one if necessary. But I have kept it abstract for now because the concrete details will complicate the question considerably and seem to me entirely extraneous.)


Viewing all articles
Browse latest Browse all 217

Trending Articles