AnsweredAssumed Answered

GetField( ) issue with global variables?

Question asked by realgrouchy on Nov 19, 2016
Latest reply on Nov 19, 2016 by user19752

I'm trying to set up a configuration page with global variables. I have a series of portals and I want the user to be able to select which values are filtered in each portal. So I have a global field for each portal: "Config::PortalAValuesToInclude", "Config::PortalBValuesToInclude", etc., and this field is displayed as a checkbox set pulling from the "Categories" value list.

 

I also want the user to be able to customize the name of the portal, but if they don't to default to a list of the values selected for that portal. So I have a field for each portal name: "Config::PortalAName", "Config::PortalBName", etc., as well as "Config::PortalANameCustom", "Config::PortalBNameCustom", etc. There are also global.

 

The PortalAName field is a calculation field that is supposed to display the custom field name if it is populated, otherwise to display the values from PortalAValuesToInclude, substituting line breaks with commas.

 

It works when I hard code the field names into the calculation, but I'd like to use Let notation to set the letter (A, B, C) so I don't have to change all instances of the field names in the calculation.

 

For some reason my calculation field isn't working, and I can't tell if I'm using incorrect syntax or if I'm just trying to do something that's not possible.

 

So this works:

 

If ( IsEmpty ( PortalANameCustom ) ;

If ( Substitute ( PortalAValuesToInclude ; ¶ ; ", " ) ;

PortalANameCustom

)

 

But this doesn't:

 

Let (

[

letter = "A" ;

customname = GetField ( "Portal" & letter & "NameCustom" ) ;

valuestoinclude = GetField ("Portal" & letter & "ValuesToInclude" )

]

;

If ( IsEmpty ( customname ) ;

If ( Substitute ( valuestoinclude ; ¶ ; ", " ) ;

customname

)

)

 

I've tried numerous variations with Evaluate, GetField, intermediate variables, with and without quotes. Occasionally I think I have something that works but then it doesn't update when I change the values in the checklist. What am I missing?

 

I'm currently using Windows 8 with FMPA15.0.2.220, if that makes any difference.

 

- RG>

 

Edit: Also, I've spent way more time on these calculations than if I just manually updated the references to the fields!

Outcomes