Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Step?

Status
Not open for further replies.

mastang13

MIS
Jun 9, 2003
26
US
I found this FM BusinessTracker db and I'm trying to learn from it.This db has a script call Go To Module thats kind of a navigation script. I don't understand the first part of the script and was wondering if any body can tell me what is does? I'm running FM 8.5

Enter Brwose Mode

If (not IsEmpty(Get(ScriptParameter))

Set Field (Preference::gLastLayout;
Case ( Preferences::gCurrentModule = Preferences::HelpModuleID; Preferences::gLastLayout; Get ( LayoutNumber ) )

Set Field (Preference::gCurrentModule;
Preferences::gNavID [ Get(ScriptParameter) ]

Set Field (Preference::gText;
Get(LayoutName)

Commit Records/Request
no dialog

Go to layout
"Settings(Preferences)

If(not IsEmpty(AccountModuleInfo::LastLayout)
Go to Layout (AccountModuleInfo::LastLayout)

Else
 
I don't have BT (yet), so if you say:

'I don't understand the first part of the script ',
is what you show in your post the first part, or do you not understand a part of what you're showing in your post ?
 
JeanW
What I posted is the first part of the script.Will post entire script maybe it will help. I need help with the part between the dash lines.
Thanks
----------------------------------------------
Enter Browse Mode
If [ not IsEmpty(Get(ScriptParameter))]
Set Field [ Preferences: :aLastLavout Case ( Preferences: :gCurrentModule = Preferences:: HeIpModuIeID; Preferences: :gLastLayout; Get (LayoutNumber))]
Set Field [ Preferences::aCurrentModule Preferences::gNavID [ Get(ScriptParameter)]]
Set Field [ Preferences::aText Get ( LayoutName)]
Commit RecordslRequests
[No dialog]
Go to Layout [ “Settings” (Preferences)]
If [ not IsEm pty(AccountModulel nfo: : LastLayout)
Go to Layout [ AccountModulelnfo::LastLayout]
Else
-----------------------------------------------------

If [ Preferences::gCurrentModule = Preferences::HomeModulelD //Home section]
Go to Layout [ “Home (Date Range)” (Preferences DATE RANGE VIEW)]
Else If [ Preferences::gCurrentModule = Preferences::CompanyModulelD //Companies section] Go to Layout [ “Company List” (Company)]
Else If [ Preferences::gCurrentModule = Preferences::ContactsModulelD //Contacts section
Go to Layout [ “Contact List” (Contact)]
Else If [ Preferences::gCurrentModule = Preferences::productsModulelD //Products section
Go to Layout [ “Product List” (Product)]
Else If [ Preferences::gCurrentModule = Preferences::lnvoicesModulelD //Invoices section]
Go to Layout [ “Invoice List” (Invoice)]
Else If [ Preferences::gCurrentModule = Preferences::ReportsModulelD //Invoices section]
Go to Layout [ “Reports” (Preferences)]
Else If [ Preferences::gCurrentModule = Preferences::HelpModulelD //Help section]
Go to Layout [ “Help” (Preferences)]
Else If [ Preferences:: gCurrentModule = Preferences:: PreferencesModulel D //Preferences section
If [ PatternCount ( Get ( PrivilegeSetName) ; Data Entry)]
Go to Layout [ original layout]
Go to Related Record [ From table: “Account CURRENT”; Using layout: “Preferences” (Preferences)]
[Show only related records; New window]
Else If [ PatternCount ( Get ( PrivilegeSetName) ; Manager )]
Go to Related Record [ From table: “Account CURRENT”; Using layout: “Accounts” (Preferences)] [Show only related records]
Extend Found Set [ Specified Find Requests: Find Records; Criteria: Preferences::privileaeSet: Data Entry”] [Restore]
Else If [ PatternCount ( Get ( PrivilegeSetName) ; Full Access )]
Go to Layout [“Accounts” (Preferences)]
Show All Records
Else
Beep
Show Custom Dialog [ Title: No Access; Message: As a Guest, you dont have access to Preferences.; Buttons: “OK”]
End If
Else
Set Field [ Preferences:: aCurrentModule: Preferences:: gText]
Go to Layout [ original layout]
Beep
Exit Script []
End If
End If
Perform Script[....Clear Sort Headers"]
End If
Perform Scrip ["IWP Navigation"]
 
Thanks.
What is it that you don't understand or needhelp with.

I can go in a lot of details that you already know...
Can you be a little more specific, is it the general working, how to do it, what it does, why it has these steps....?
 
JeanW

what does this step do?
If [ not IsEmpty(Get(ScriptParameter))]
 
>>what does this step do?
If [ not IsEmpty(Get(ScriptParameter))]

This script is probably triggered by a button, with the define button function.
When you are in the button settup screen, you can asign a script to the button (left pane) and specify the script (button at the right side).
In the specify script options screen, you can specify the script but also, at the bottom, specify a script option.
This can be a single letter or a whole calculation.

The given script is first checking if there is a parameter and will act upon that.

Practical example.
Lower than 7/8, when you have for each letter of the alphabet a button, to find records beginning with the given letter, you needed 26 scripts.
Now you need 1 script and give a parameter at each button/letter triggering the 1 script.
The conditions for the script is in the parameter:
If (getscriptparameter) = "a", -your search for a here- ;
If (getscriptparameter) = "b", -your search for b here- ;
If (getscriptparameter) = "c", -your search for c here- ;
etc.

If the user clicks on "A" (where the parameter is "a", the script will check for the parameter, which is "a", and will execute the "a" part of the script = search for a....
Same goes for b, c, d, etc.

>>If [ not IsEmpty(Get(ScriptParameter))]
Will check if the parameter box is empty, if it's not it will do the scriptportion forthe given parameter.
If it's empty it will probably acting on the given scriptpart for 'no given parameter'.

See the helpfile to discover other uses of this very powerfull tool.
You can even give parameters between scripts...

If you need more help, feel free.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top