Novice Troubleshooting Suggestions
Realize that in expressions you are referencing the source field, not the target field. The target field is implied in the expression, since the target is where the data is directed.
Use the most efficient function for your task
• Read about it. Look through the function list and choose a function to read about. Study how the function is used in the example.
• Search for your situation in the documentation. For instance, if you need to parse phone numbers, type in "phone number" and see what documentation sections appear. For example, the Format function is on the list. This function helps you parse phone numbers into your desired format.
• Start spreading the news. Other users may have suggestions for your particular situation and can tell you what function works best. Others are a great resource and provide a wealth of knowledge about solving real world problems. Go to our website, then check out the support communities.
Understand the difference between syntax errors and errors in logic
Syntax is an important consideration when writing expressions. For example, you run into trouble if you forget to enclose a string in quotation marks.
Logic is another matter. Your arguments must be logical in order to return the data you expect to the target.
Note: Script Editor indicates that your expression is valid if your syntax is correct, but your logic may not be correct. This is because expressions are actually processed at runtime, and errors in logic are written to the log.
Validation is invaluable for checking work when using Script Editor. The best way to remedy errors is to change only one thing and then validate again. If you still get an error, try another change, and so on. This makes troubleshooting syntax easier than if you make many changes before validating.
Use comments to document your expressions
Make it a practice to always use short descriptions to illustrate what you are doing in each line of code. At the very least, include a comment line or two explaining what you are doing in the entire expression.
Example
'Declare the DJImport object and set its connection string. You must change the connection string to point to your database and server. Location: BeforeTransformation event, Execute action:
Set myvariable = new DJImport "SQL Server 7 (OLEDB)"
myvariable.ConnectString = "Server=Server1;Database=Tester;UserID=sa"
'This is a snippet from a larger body of code. The variable called "myvariable" has previously been declared.
Last modified date: 12/03/2024