Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Using a Field Name as a variable/by calculation


Tjebbe
 Share

Recommended Posts

I may have overlooked some option, but as far as I could

find out the manual of Filemaker (8 advanced) does not give any option

for setting the value of a field by giving the field name as a variable

in a calculation.

 

In other programming environments this is a normal functionality, I can

not find it... though!

 

I am writing a new parser module for various bibliographical data from

on-line catalogues and have made a table with concordances of various

bibliographical data format to parse (MARC, MOPC, etc.).

 

In a regular looping routine I take each line of the bibliographic data

(using Troi tex plug-in line number) and from the initial code of that

line my concordance table can tell where that bit of information should

go (and what subsequent reformatting needs to be done on that

particluar line).

 

It is obvious that the code can be simple and short when the set field

commando (or another one) can be based on a variable that is calculated

from the concordance table, BUT I can only see an option for choosing a

specific field...

 

Well I may have missed something, forgot about the Filemaker way to go

around...

 

In the mean time I use Applescript as a work around:

 

tell application "FileMaker Pro Advanced"

set Gstring to get data cell "gTemp02X" of current record

set data cell "#01" of current record to Gstring as text

activate

end tell

 

whereby "#01" is the place where the name of the calculated field comes

(set by a substitute command)

 

I will be grateful when someone on this Forum can point me out my

lapsus, or a more charming way of doing this.

 

 

Tjebbe van Tijen

Link to comment
Share on other sites

Thank you for your reply...

but as far as I can see this function does not help

 

I need to SET a value and not to GET a value.

 

Filemaker seems to have only this limited option which is TARGET FIELD

and that one is hard-coded... you have to give a specific field name

(you can now calculate to set the value of a repeating field)

but I see NO option to calculate a field name...

 

I have calculated the field name through a relationship with my concordance table; the missing bit is to be able to use one routine

for setting multiple fields

 

or... I may have not understood your suggestion (as FMP has often workarounds that are not so obvious)

 

Hope you will reply

 

tjebbe

Link to comment
Share on other sites

Sorry... i was too quick to reply. As far as I know indeed there is no way to set a field dynamically. Would be nice though...

 

A possible workaround is to loop through the fields in the active layout, which is kind of clunky and possibly not much of an improvement of your applescript. But it's platform independent as it's filemaker-internal.

 

set variable [$VariableToSet; YourCalculation]
set variable [$FieldToPick; YourOtherCalculation]
freeze window
go to layout [AllPossibleFields]
go to field [first]
loop
 if [ get(activefieldname) = $FieldToPick ]
   set field [$VariableToSet]
   set variable [$ExitCondition;1]
 end if
 exit loop if [$ExitCondition]
 exit loop if [get(activefieldname)="NameOfLastFieldInTabOrder"
 go to field [next]
end loop
go to layout [original]

 

typed from memory... excuse any glitches. Let me know if it works out.

 

Maarten

 

ps tweaked script

Link to comment
Share on other sites

Thank you Maarten...

 

Yes I am (sadly) very familiar with using a lay-out and stepping with Go Next Field through it (the way I have solved for years the missing option to address by calculation a specific repeating field); this solution is what I wanted to evade... it makes your lay-out somehow part of your code... which works, but makes the magement of the code a difficult task... (as the Tab order determines the Go Next Field Step...

 

As I need to build a parser for the many diffrent types of bibliographical encodings... which may have all together hundreds of coded fields; I do not want to use this option...

 

I think checking the plug-in realm may help... remember vaguely an Australian wizzard who makes plug-ins withe the name Jazz who had once a plug-in for variables... I have also posted my question on the Troi plug-in list...

 

It is ABSURD that the functionality of setting values to a CALCULATED FIELD NAME is not included in FMP newer versions (als we had to wait years before we could properly address a repeating field)..

 

if you think up something better let me hear

 

nicest greetings

 

tjebbe

Link to comment
Share on other sites

OK what about this:

an intermediate field called DataEntry

a picker field that holds the name of the field to pick, you set it in your script.

 

and for any field that may be chosen the following auto-enter calc, replaces existing:

 

Case(PickFieldName="ThisField";DataEntry;"")

 

Kind of a wild idea, haven't thought it through.

 

maarten

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use