You can always play around with Triggers. The trigger could include If-statement where you use Go to portal row and check values.
OnObjectModify is a trigger to use for your first field
The script trigger tip was very helpful. I had set up the script before, but couldn't understand why it wasn't running when my "If" conditions were met.
Solution (I think) spelled out for beginners:
1.) Establish a script... go to "Manage scripts" and create new script.
- Go to Field [your database name::field]
- If [Source = "Hands"]
- Go to next field
- insert text [Select; your database name::field; "HCW hands"]
- Go to Field [next field]
- Else If ....
- End If
2) From the layout tab, go to the Format menu, "set script triggers", then use "OnObjectModify" and set to trigger the script you just created.
Does that sound right? It seems to be working for me, but perhaps there are more elegant solutions out there.
Thanks a lot for your help!
You need to use the Go to next portalrow, not Go to Field.
Instead of using literal values (e.g. Hands), I recommend using related fields. I would set it up this way:
- (at least) Two tables: say, Main (your current table) and Details (two fields: key_Source and Detail)
- A relationship between Main and Details, based on the Source fields
- Value List 1: based on values in the Main::Source field (Use values in field)
- Value List 2: based on the relationship between the Main and Details tables and displaying values from Details::Detail
- On the layout (Main table), the Main::Source field is a pop-up based on Value List 1
- Same layout, place a Main::SourceDetail field, a pop-up based on Value List 2
Your script trigger could populate the Detail field from Value List 2. GetValue(Value List 2; 1) could be used if the first value in the list is the desired default. To create a default setting, you'd need to take this technique a bit further.
edited to clarify and make more explicit
If i get it correctly, you want auto-enter calculation on 2nd field like
Left ( firstField ; 0 ) & GetValue ( ValueListItems ( Get ( Filename ) ; "valueListNameFor2ndField" ) ; 1 )
with replace existing value.
Left() make trigger on changing firstField. This can be done with Evaluate() function also, but I don't like escape " this case.
Evaluate ( "GetValue ( ValueListItems ( Get ( Filename ) ; \"valueListNameFor2ndField\" ) ; 1 )" ; firstField )
Hi again Johan,
It seems to be working with the Go to field . What would be the advantage of using Go to next Portal instead?
I would do your script in a Loop where you dont know how many records you have and therefore use Go to next portal row can continue forever or until you decide to Exit your loop