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

FileMaker Pro Script problem


Geneo3711

Recommended Posts

Hi,

Am having trouble with the find portion of the script below. In Transfer To Record am getting “Serial Numbers Transferred to Names Record ID 331218, 7/6/2012.” And no SN’s. This is the way Transfer From Record should look. Transfer From Record has SN’s but no comment. I feel the problem is with the find statements.

Am working on my Script skills so there could well be a better way than what I’ve done below.

Any suggestions would be greatly appreciated.

Geneo3711

Script Purpose: Remove serial numbers data from a record (Transfer From Record) and transfer it to another existing record (Transfer To Record). Also to display a list of serial numbers , the NamesRecordID moved to, and date in Transfer From Record (Field: TransComment). In Transfer To Record display the NamesRecordID moved from and date.

 

Allow User Abort [Off]

#Script to get user’s input.

Perform Script [“NamesRecordID”] (field: Get__NamesRecordID, number, global)

#Set valuesfor Serial Numbers

Set Variable [$SN1; Value:Names::SN1]

Set Variable [$SN2; Value:Names::SN2] (multiple variables not listed)

#Set Values for Names Record ID that records are being transferred from.

Set Variable [$TransFromNameID; Value:Names::NameRecordID]

Set Variable [$TransCompany; Value:Names::Company] (to be used in a similar script)

#Set Values for current date and Serial Numbers to insert into TransComment fieldin the Transferred From Record.

Set Variable [$Date; Value:Get ( CurrentDate ) ]

Set Variable [$st_SN1; Value:Names::SN1]

Set Variable [$st_SN2; Value:Names::SN2] (multiple variables not listed)

#Inserts Serial Numbers into fields of Transferred To Record.

Enter Find Mode [specified Find Requesta: Find Records; Criteria: Names::NameID: “Get_NamesRecordID”] [Restore]

Set Field [ Names::NameID: Names::Get_NamesRecordID]

Preform Find [ ]

Set Field [Names::SN1; $SN1]

Set Field [Names::SN2; $SN2] (multiple variables not listed)

Set Field [Names::TransComment; “Serial Numbers transferred from Names Record ID “ & $TransFromNameID & “, “ & $Date & “.”]

#Clears SN’s from Transfer From Record.

Enter Find Mode [ Specified Find Requests: Find Records; Criteria: Names::NameID: “$TransFromNameID” ] [Restore ]

Set Field [ Names::NameID; $TransFromNameID ]

Preform Find [ ]

Set Field [Names::SN1; “”]

Set Field [Names::SN2; “”] (multiple variables not listed)

Set Field [Names::TransComment; “Serial Numbers “ & $st_SN1 & $st_SN2 & (multiple variables not listed) & “transferred to Names Record ID “ & Name::Get_NamesRecordID & “, “ & $Date & “.”]

Exit Script [ ]

Link to comment
Share on other sites

Am having trouble with the find portion of the script below.

 

Yes, you are:

 

Enter Find Mode [specified Find Requesta: Find Records; Criteria: Names::NameID: “Get_NamesRecordID”] [Restore]

Set Field [ Names::NameID: Names::Get_NamesRecordID]This won't work. You do not have a value in a field Get_NamesRecordID right now, because you're in Find Mode

Preform Find [ ]

Set Field [Names::SN1; $SN1]

Set Field [Names::SN2; $SN2] (multiple variables not listed)

Set Field [Names::TransComment; “Serial Numbers transferred from Names Record ID “ & $TransFromNameID & “, “ & $Date & “.”]

 

 

 

Change it like so:

 

Set Variable [$NamesRecordID; Names::Get_NamesRecordID]

Enter Find Mode [] do not restore requests here!

Set Field [ Names::NameID: $NamesRecordID]

Preform Find [ ]

Set Field [Names::SN1; $SN1]

Set Field [Names::SN2; $SN2] (multiple variables not listed)

 

 

You also write:

This is the way Transfer From Record should look. Transfer From Record has SN’s but no comment

 

well, you're setting the field TransComment in the next script step, not conditionally but always:

 

 

Set Field [Names::TransComment; “Serial Numbers transferred from Names Record ID “ & $TransFromNameID & “, “ & $Date & “.”]

 

 

So it would always have a comment.

Link to comment
Share on other sites

AHunter3

Sorry to take so long in getting back to you. Did not get back to this script till today.

Thanks for the reply, it was very helpful. I now have a better understanding of Set Variable and Set Field with Find Mode. I eliminated the Set Field step because with two finds it was not working.

 

Changed to:

 

Set Variable [$NamesRecordID; Names::Get_NamesRecordID]

Enter Find Mode [specified Find Request: Find Records; Criteria: Names::NameID: “Get_NamesRecordID”]

Preform Find [ ]

Set Field [Names::SN1; $SN1]

Set Field [Names::SN2; $SN2] (multiple variables not listed)

 

Also changed order of the finds. Works as planed now.

 

This script is a subscript. When this script runs it is suppose to always put the comments in.

 

Thanks again for your help.

Link to comment
Share on other sites

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