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

Script duplicate record & change a value in one field


BH8269

Recommended Posts

I have a commissioning DB.. It maybe that in it's lifetime a unit in this DB has a fault & has to be re-commissioned..

 

What I am after doing is to have a button that says RE-COMMISSION this will duplicate the current record, the field IMEI_No value needs to be prefixed in the original record with an X X350389830000000 and this is then the old record the duplicated record IMEI_No field would then equal 350389830000000 will then become the current record.

 

Many thanks,

 

Bru.

Link to comment
Share on other sites

Something along the lines of:

 

1 marking the current record with a "1" in a particular/dedicated field

2 setting a global field with the ID number of the record

3 duplicating the record ( i.e the new record)

4 finding the old record with the mark added in step 1

5 replacing the old ID number with a set field calculation of "X" & the ID number from the global in step 2

Link to comment
Share on other sites

This script will work:

 

Set Field [ Table::IMEI_No; "X" & Table::IMEI_No ]
Duplicate Record/Request
Set Field [ Table::IMEI_No; Right ( Table::IMEI_No; Length(Table::IMEI_No) - 1 ) ]

 

Note to efen: be very careful with marking records in a multi-user system. What would happen if two people marked records at the same time? What's more, you need to unmark that record after the replacement. Anyway, you should be able to see from the above that marking the record is unnecessary. ;)

Link to comment
Share on other sites

This script will work:

 

Set Field [ Table::IMEI_No; "X" & Table::IMEI_No ]
Duplicate Record/Request
Set Field [ Table::IMEI_No; Right ( Table::IMEI_No; Length(Table::IMEI_No) - 1 ) ]

 

;)

 

Hi David,

 

Is this code for FP6?

 

Regards,

 

Bru.

Link to comment
Share on other sites

I seem to think that the semicolons should be commas for FP6, please excuse my ignorance on this from a newbie but what is the table:: defining? I really want to understand & get to grips with the scripts could you please explain a little more?

 

Thank you,

 

B.

Link to comment
Share on other sites

Sorry, the principle works in FP6 but the script needs to be modified. Use commas for argument separators and you don't specify table names:

Set Field [ "IMEI_No", ""X" & IMEI_No" ]
Duplicate Record/Request
Set Field [ "IMEI_No", "Right ( IMEI_No, Length(IMEI_No) - 1 )" ]

Above is how the script will appear in ScriptMaker.

Link to comment
Share on other sites

Please have a look at the online help topic for how to use the Set Field script step. There are two options:

 

1. Specify target field - this is where you would select the IMEI_No field

2. Calculated result - this is where you would enter "X" & IMEI_No

 

As I said in my post - "Above is how the script will appear in ScriptMaker."

 

Hope that helps but please read the help file too.

Link to comment
Share on other sites

  • 3 weeks later...
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use