Maybe the solution that I got in the past (and I got that solution in this community) you can try the following.
1st - Have your users / password as project attributes
2nd - Add the GetMyLocation.bdh to your project to add the ability to "recognize" your execution server.
3rd - Create logical IF to check which execution server is executing the script and based on that use the correct project attribute.
How to use the GetMyLocation.bdh (save the code listed below in a file called GetMyLocation.bdh inside the your WORKING\CUSTOM INCLUDE folder)
OBS: Please note that I customized the IF creating a friendly name that I can use into my start/stop measures.
- add the USE GetMyLocation.bdh in the top of your code.
- declare a string like sLocation : string; in your var session.
- call GetMyLocation(sLocation); in your begin session that will return the current execution server.
var sLocation : string; dclfunc function GetMyLocation (sNewLocName : string) begin sLocation := GetController(); // print ("My Location is " + sLocation); Substr(sLocation, sNewLocName, 1, 3); if sNewLocName="HOE" then sNewLocName:="Houston"; elseif sNewLocName="DAL" then sNewLocName:="Dallas"; elseif sNewLocName="LHD" then sNewLocName:="Leatherhead"; elseif sNewLocName="SNG" then sNewLocName:="Singapore"; elseif sNewLocName="CGY" then sNewLocName:="Calgary"; elseif sNewLocName="CTC" then sNewLocName:="Curitiba"; elseif sNewLocName="MLB" then sNewLocName:="Guinea Equatorial"; else sNewLocName:=sLocation; end; // print ("My NewLocation is " + sNewLocName); end GetMyLocation;
Let me know if you need any help on that.
PS: Or you can simply add the GetController() function into your code. I add that into a CUSTOM INCLUDE because I using it in ALL my scripts.
Ping me if you need.
GetMyLocation.bdh.txt 833 bytes
1 of 1 people found this helpful
Very nice, Flavio Bonacordi!
Ian Butler, what Flavio has described is a good approach.
If your locations are likely to change you can also put the credentials into a CSV or XML file. Add the file as a "data" file to your Workbench project and it will be distributed to your Execution Servers. BDL has a robust set of functions for reading and extracting data from CSV and XML files.
Guys, thanks very much for your prompt response.
I actually like both options!!
It will be more about what works for us in the long term, which might sway me to look into your Data file option Hal.