Jump to content

Getting the internal script ID


This topic is 2217 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I dont think that the internal Id of a script is exposed anywhere.

The only place i can think of is the DDR.

The important thing is... what problem are you experiencing that would be solved by knowing a script ID?

Link to comment
Share on other sites

18 hours ago, kiwioz said:

can someone help me, with a way of finding the  internal script ID

 

Given the name of a script, you can use the Design functions to work out where its name appears in the List of scripts and knowing that, deduce its scriptID - because it appears at the same level in a List of all your script IDs.  Or use this calculation:

Let ( [

WantedScriptName = "MyScriptName" ;     //  <-- the name of your script goes here
AllScriptNames = ScriptNames ( "" ) ;
AllScriptIDs = ScriptIDs ( "" ) ;
PositionOfScript = Position ( ¶ & AllScriptNames & ¶ ; ¶ & WantedScriptName & ¶ ; 1 ; 1 ) ;
Nth_Item_In_List = ValueCount (Left(AllScriptNames ; PositionOfScript)) ;
ScriptID = GetValue ( AllScriptIDs ; Nth_Item_In_List ) ] ;

ScriptID )

 

Ralph

 

Link to comment
Share on other sites

Hi Ralph,

That works! :)

18 hours ago, kiwioz said:

can someone help me, with a way of finding the  internal script ID

This is the first time I  have seen this request and I too wonder why are you need this information.

Link to comment
Share on other sites

Hi kiwioz,

Knowing the internal ID can come in handy in many situations which can eliminate possibility of indirection, thus eliminating need to hard-code.  There are custom functions which are quite useful and can be used to get the internal ID of fields, layouts, etc.

The attached file holds a custom function by Fabrice Nordmann.  He and others have created these multi-purpose custom functions to handle your need.

ScriptID.fmp12

BTW, knowing the script ID is helpful if you are testing for the current running status of another script and you do not want to hard-code the script name.

Edited by LaRetta
Link to comment
Share on other sites

5 hours ago, Kris M said:

The only place i can think of is the DDR.

I just did a DDR on one of my files (scripts only) and don’t see this information on it.

36 minutes ago, LaRetta said:

The attached file holds a custom function by Fabrice Nordmann.  He and others have created these multi-purpose custom functions to handle your need

Here is the link to the CF LaRetta is using,

http://www.briandunning.com/cf/858

BTW, there is more to it then the Scripts ID. Worth looking at for other needs too.

 

Link to comment
Share on other sites

8 minutes ago, Lee Smith said:

BTW, there is more to it then the Scripts ID. Worth looking at for other needs too.

Yes, and that is why we use custom functions for the functionality ... the single CF can be used for different needs and it is quite helpful.  There are links within the custom function itself, and I had also added the link within the CF itself (at the bottom) to Brian Dunning's site.  Matt Petrowsky, Jeremy Bante, Dan Smith and others all have variations available from which to choose.  :-)

Link to comment
Share on other sites

Here is an example of why one might need the script IDs: fixing a data-separated solution. We have a dev server and a live server, and every two weeks or so we move the dev UI file to the live server. We do have to watch out for field IDs in the live vs. dev data files, we're very careful about adding new fields, but almost all scripts reside in the UI file so we tend to not think about that much.

However, last month I noticed an issue with a 3rd file, our log file. When me moved our UI file from dev to live, a script in the UI file ended up pointing to an incorrect script in the log file. That is one place where FileMaker is linking things by internal ID.

I used the built-in ScriptIDs ( "" ) and ScriptNames ( "" ) functions on the dev log and live log files. When I put the results together, the results looked like:

1 A
2 B
3 C

in Dev, vs. in Live:

1 A
3 B
4 C

So while on the surface the script names all looked the same, the result was that the file on the Dev server pointed to script (3) which was C on the Dev server, then when moved to the live server pointed to script B!

To resolve this, I did something like duplicate script C twice on the dev server, and once on live. So the script ID was now 5 on both. Back in sync!

  • Like 1
Link to comment
Share on other sites

This topic is 2217 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.