panchristo Posted August 18, 2010 Posted August 18, 2010 Hi, I am trying to develop best practices with scripts and variables, can you please answer the following: 1)Are variable names case-sensitive? 2)Is it good practice to pass named script parameters (e.g. a=5) and what's the best way to distinguish them (; or CR)? 3)Am I correct if for any executed script that has parameters I set variables that split up those in order to use them inside the script? From what I've read from FM-Help a method for this is: Evaluate("Let([" & Get(ScriptParameter) & "]; variable)") Does anyone agree/disagree? Is there any free resource you know for developer's best practices? 4)If you perform a script to open a modal window using a Loop and a Pause [indefinetely] until Exit IF is satisfied, is it possible to pass any variables from this script to any script additionaly triggered from the layout (e.g. OnModify) to be used as well?
Vaughan Posted August 18, 2010 Posted August 18, 2010 The variable name case sensitivity is easy enough to test yourself. As for 2) any parameter delimiter should be chosen to be a character that will not be in the values themselves. One advantage of using CR is that the built-in value handing functions can be easily used for parsing them. 3) I have no idea why you're using the Evaluate function. I don;t think I would consider that best practice.
panchristo Posted August 18, 2010 Author Posted August 18, 2010 1)Are variable names case-sensitive? Ok, found this one in FM Help: A variable name has the same naming restrictions as a field name.
panchristo Posted August 18, 2010 Author Posted August 18, 2010 I was thinking of passing parameters to scripts like: window=modal IDField=pkLineItemID ... I was thinking that in this way I could minimize the number of scripts I will be using by changing only specific variables. Using the Evaluate() I would easily parse the "pkLineItemID" string from the example above to set the variable inside the script along with a Get(LayoutTableName) function and a "::" connector in a SetFieldByName script step. To put it simply, it would help me sort out which parameter should be which variable inside the script. What do you think?
Ron Cates Posted August 18, 2010 Posted August 18, 2010 (edited) You can pass names variables in a script parameter like this; " Let ( [ $id =Customers:_pk_cusID; $action = "View"; $$doc = "Contract" ] ; "" ) " Then you would use Evaluate("Let([" & Get(ScriptParameter) & "]; variable)") in the beginning of your script. This can be used to set local or global variables. Edited August 18, 2010 by Guest
Recommended Posts
This topic is 5212 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 accountSign in
Already have an account? Sign in here.
Sign In Now