Is this possible?
Set Variable [$ActiveField ; Value: Get (ActiveLayoutObjectName )]
If [Globals::g&$ActiveField&Number = ""]
where active field name is Unit and global field is gUnitNumber
There is GetField() function. FileMaker Pro 16 Help
Or Evaluate() can do same thing.
Get(ActiveFieldName) may be better for getting field name.
You might also use Get ( ActiveFieldContents ) to access the value of the currently active field.
Thanks, yes there are many ways to get the variable, however if the global field is not the active field and I want to know if the global field is empty using the variable in the If statement, Globals::g&$ActiveField&Number (Actual field: Globals::UnitNumber). Is this possible?
Maybe this will help.
I have a layout with several fields one is a field that allows selection of a unit number form the units table. Then I have a script that writes the value from the units field to a Globals::gUnitNumber. then I want to check the globals table for, in this case Globals::gUnitNumber = "". In other cases "Unit" will be something else like Project, Build, Personnel.....
So my ultimate question is can I use a variable within the <table>::<field> function?
I hope this makes sense.
Your question has already been answered. Both GetField or Evaluate are functions that can use a calculation that, when evaluated, produces the tableOccurrence::FieldName reference to a field.
In your original post, you used get ( activeLayoutObjectName ) to get a value for your variable. That would only work if you assigned the tableOccurrence::Field text as the object’s name and only returns a value if the object has the focus. If that object is a field, that field would be the active field.
I thus suggested Get(ActiveFieldContents) as a simpler way to get the same value.
It might be simpler to pass this text to your script as a script parameter.
Sorry, I think we are hung up on the Active Field...
Let's say the script looks like this:
#Current Layout is not Globals.
# This Set Variable is just for calcification of this question.
Set Variable [$Name; Value: "Unit"]
# This is what I'm asking is there a way to use a variable within Globals::gUnitNumber as shown below.
If [ "Globals::g"&$Name&"Number" = ""]
I know I could use the Go to Layout function then the get function, but that's not my question.
The getField function does answer your question. You can't use the expression you have posted. I assume that you have found that out, but you can use:
If [ GetField ( Globals::g"&$Name&"Number" ) = ""]
You can also use:
If [ IsEmpty ( GetField ( Globals::g"&$Name&"Number" ) )]
Yes, I have tried many variations and thought I would ask just in case I was overlooking something, wouldn't be the first time.
Retrieving data ...