Jump to content

Scrpit steps and field verification


amigotto

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

Recommended Posts

Hello,

I´ve written a script which creates a new record by copying given fields from a specific record to DIFFERENT fields in the new record. The way I have it set up, the record which originates the information for the new record is referenced with a globalID field which is copied from the RecordID.

The script works fine but goes back and forth between the two records a number of times in order to copy all the necessary fields.

The problem with this is that I had certain fields which were configured as "Not Empty" and validated. Needless to say I have to turn of field validation for the script to work, because certain fields aren´t yet filled in while the script moves between records.

Is there any way to copy several fields from one record and paste them into DIFFERENT fields of a new record in one step?

Is there any way to disable field validation while the script runs?

Also, if a date field is set to "Not Emtpy", is there any way of searching for records with empty fields? I turned on validation because many records were being left with empty fields.

Thanks.

Cheers,

Alvise

Link to comment
Share on other sites

i suggest you use a SINGLE GLOBAL [ or pass a script parameter ] to hold the information from ALL of the fields of your original record. using a global means you don't need additional relationships. and a single variable means you don't have to go back and forth between the two records.

this is a common filemaker technique. all you need to do is create a calculation to put each field into the global filed with a return character "¶" between each field. [ don't forget to add one final return character at the end of the final string as well ]. this technique provides a long 'list' of information with one entry for each field, like paragraphs in regular text. you can access any item on this list in any order with the function MiddleValues ( text ; startingValue ; numberOfValues ) which is new in FMP 7. for instance, the syntax for accessing the third item in the list is MiddleValues ( gMyGlobal ; 3 ; 1 ).

hope this puts you on the right track

trev

Link to comment
Share on other sites

Thanks for your reply! Now why didn´t I post questions here BEFORE...?

Anyway, it works very well, except that the carriage returns are also copied to the field entries. How should they be inserted in the script?

The steps I have to copy field data into the global are:

Copy [select; field]

Paste [select; field]

Insert Text [field; " " ] - I´m inserting a carriage return here

then to paste in new record:

Set Field [field; MiddleValues ( field ; 1 ; 1 ) ], etc

Thanks again for your help,

Alvise

Link to comment
Share on other sites

This topic is 6681 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.