Adam Bell
asked on
I have a script to set the next document number, I can calculate it but unable to write to a field
Hello, I have a FM Pro 15 Advanced Script, which has trouble setting the specified field values, I've a feeling there is a 'Filemaker' way to do it and I've missed out a step or two but unable to so far to glean from forums what that might be. Any pointers much appreciate:
Context: table
Valid Relationship: table = table 7 on Field1, Field2, Field3
Script step that doesn’t work: Set Field by Name [table 7::field4]; table 7::field4 + 1
Field 4 is number. I am trying to get the current last record reference number for a document and insert the next number to specified field which is also a number. The calculation will return correct number to dialog assigned as a variable. But not set to field. No obvious errors popup.
Context: table
Valid Relationship: table = table 7 on Field1, Field2, Field3
Script step that doesn’t work: Set Field by Name [table 7::field4]; table 7::field4 + 1
Field 4 is number. I am trying to get the current last record reference number for a document and insert the next number to specified field which is also a number. The calculation will return correct number to dialog assigned as a variable. But not set to field. No obvious errors popup.
There could be various reasons this is happening but try adding a Commit Records [ No Dialog ] step after your Set Field step.
ASKER
Thanks Will
have added Commit Records but no joy..I've exhausted (what to me) is obvious checks including trying to set the data to the source table instead of related. So it seems more on the commit than pass in script side but I will trap for errors and see what comes out..
have added Commit Records but no joy..I've exhausted (what to me) is obvious checks including trying to set the data to the source table instead of related. So it seems more on the commit than pass in script side but I will trap for errors and see what comes out..
Can you send a sample file? Also, is there any chance the relationship between table and table7 is using Field4? Meaning that the relationship is no longer valid when you use Set Field?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks to Will and HC for their time and helpful input. My takeaway from this is to brush up more on the more common functions ie which one best used in a particular context as sometimes the documentation readily searchable is not 'at a glance' clear; not that it doesn't say it but takes real reading to absorb and retain.