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

how to make my script leaner


Marmot

Recommended Posts

I have a layout in TableA. It has two fields into which I put info from two other related tables, (Table1, Table2). The related field is job_ID.

 

I have two scripts to get info from T1 and T2 which are basically the same.

 

The outline of the scripts is:

 

set field (TabA_global; TabA_field)

go to T1 or T2 layout

enter find mode

set field (T1 or T2 field; TabA_global)

perform find

set field (T1 or T2 global: find result)

go to TableA layout

set field (TabA_field; T1 or T2 global)

 

Is there a way of getting the Table 1 and Table 2 field info at the same time ?

 

At the moment, I have to run the Table1 version of this script, then the Table2 version one after the other. They both work, but this process seems to me cumbersome.

 

This must be true since the find info from TableA for T1 and T2 is the same!

 

Marmot

Link to comment
Share on other sites

If you don't mind, before we hack scripts, have you considered using calc fields?

 

In other words, it appears your central database has some kind of key into the other 2 tables, so why not define a relationship and then either use AutoEnter or calc fields to access the tables?

Link to comment
Share on other sites

An auto-enter calc for a static text field can deliver static info after a specified date.

 

Use the evaluate function, with the first parameter being an if statement comparing the current date to a deadline date field with the default return being the current content of the field.

Link to comment
Share on other sites

I don't really understand what you're trying to do, but this looks a lot like a job for a script parameter.

If your related tables show up in a portal, you can put a button in the portal row, and make the script parameter the field of that row, then, in the script, you just use the Get(ScriptParameter) function, then you don't need that global field...

not sure if this helps...

philo

Link to comment
Share on other sites

[ QUOTE ]

An auto-enter calc for a static text field can deliver static info after a specified date.

 

Use the evaluate function, with the first parameter being an if statement comparing the current date to a deadline date field with the default return being the current content of the field.

 

[/ QUOTE ]

 

I understand this. Thank you. I will now try and script it.

 

I see from other correspondence in the forum that folk use the Case function. Case(test1;result1{;test2;result2;defaultResult...}) Presumably it supplies a default value as well.

 

Marmot

Link to comment
Share on other sites

Well, YOU supply the default value. Think of CASE as a multi-tier IF statement.

 

It does not displace any of the suggestions made here. Building upon Biker's suggestion, you might have a situation in which you wish to use CASE instead of IF if you had a complex decision to make.

Link to comment
Share on other sites

[ QUOTE ]

 

If your related tables show up in a portal, you can put a button in the portal row, and make the script parameter the field of that row, then, in the script, you just use the Get(ScriptParameter) function, then you don't need that global field...

 

 

[/ QUOTE ]

does the cursor have to be in that field (the one which will be the parameter for the script - a find parameter for example ) when clicking the button...?

 

marmot (whistling furiously)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use