Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4766 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi

I have a problem grabbing a value in a text field containing a list.

The list is containing values from a related record and is defined: TextField = List (RelatedTable::RelatedField)

And is like:

0

10

50

100 etc.

What I want to do is to loop through this list, grab each value and create a new related record in another table an paste each value into a field.

Can anyone help me on the right track here.

Best regards,

Reynir.

Posted

create a new related record in another table an paste each value into a field.

Are you sure about this? Each value into a different field in the same record? What if there are more values than fields?

Posted

Maybe I was not clear enough about this.

The scenario is like this:

I have a calibration program table (pk_CalibrationProgram_ID, etc. which has a related table: calibration points (one or more) (pk_CalibrationPoints_ID, fk_CalibrationProgram_ID, etc.), then I have another table calibration (pk_Calibration_ID, fk_CalibrationProgram_ID, etc.) which has a related table calibration values (pk_CalibrationValues_ID, fk_Calibration_ID, what I want is when I make a calibration record for the calibration program, then I want to copy the calibration points to new records in the calibration value table.

The CalibrationProgram table is related to the Calibration table. In the calibration table I have a portal linked to both calibration values and calibration points, Then I have a ListOfCalibrationPoints = List (CalibrationPoint::CalibrationPoint) which contains the calibration points, what I want to do is to copy each calibration point, create a new record in the CalibrationValues table and paste the calibration point into a field, CalibrationPoint in the Calibration Values table.

Hope this explains what I mean.

Reynir.

Posted

If I understand this correctly, you want to select a calibration program and then create a record in CalibrationValues for each point in that program, related to the current calibration?

If so try (from a layout of Calibrations):


Set Variable [ $calibrationID ; Calibrations::pk_Calibration_ID ]

Set Variable [ $pointIDs ; List ( CalibrationPoints::pk_CalibrationPoint_ID ) ]

Go to Layout [ CalibrationValues ]

Loop

Set Variable [ $i ; $i + 1 ]

Exit Loop If [ $i > ValueCount ( $pointIDs ) ]

New Record

Set Field [ CalibrationValues::fk_Calibration_ID ; $calibrationID ]

Set Field [ CalibrationValues::fk_CalibrationPoint_ID ; GetValue ( $pointIDs ; $i ) ]

End Loop

Commit Records

Posted

Almost the right understanding.

Thank you very much. In the meantime I found another solution that worked fine (at least I manage to get it working the way I want)

CalibrationValue_List is the list of calibration points values.

The script is as follows:

Loop

Set Variable[ $line, 1 ]

# Loop over lines

Loop

Exit Loop If[ ValueCount( CalibrationValue_List ) < $line ]

#

# Get line values

Set Variable[ $fields, GetValue(CalibrationValue_List, $line ) ]

SetVariable[ $pk_Calibration_ID, Value: pk_Calibration_ID ) ]

Go to Layout(CalibrationValues)

New Record/Request

Set Field[ CalibrationValues::CalibrationPoint, GetValue( $fields, 1 ) ]

Set Field[ CalibrationValues::fk_Calibration_ID, $pk_Calibration_ID ) ]

Go to Layout( original layout )

Set Variable[ $line, $line + 1 ]

End Loop

This will help me a lot. I will try your solutuion as well. One more question: In your solution you commit records in the end, is there a reason to do so?

Again, thank you very much pointing me to the right track.

Best regards,

Reynir.

I can see in my reply there is one Loop to much in the beginning.

Posted

I think you'll find my version slightly more efficient. BTW, the calculation field CalibrationValue_List is not required.

In your solution you commit records in the end, is there a reason to do so?

Yes, because the last record in CalibrationValues remains uncommitted at the end of the loop.

This topic is 4766 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.