Pass parameters in batch mode

Hello,

I need to call a dxl in batch mode from a C# application. That works fine, but I have also to inject some parameters. I tried to use the -D switch with a string-variable before calling the dxl-script with the -b switch.
 

string dxlString = "string strFilename = \"" + cfgDxlOutputPath + "\"";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = cfgDoorsPath;
string pArgs = "-u " + cfgDoorsUsername + " -P " + cfgDoorsPassword + " -d " + cfgDoorsServer + " -D \"" + dxlString + "\" -b " + cfgDxlScript + "";
proc.StartInfo.Arguments = pArgs;
proc.StartInfo.UseShellExecute = false;
proc.Start();
proc.WaitForInputIdle();

 


I get the following error:

 

 

 

-E- DXL: <Line:1> undeclared variable (d)
-E- DXL: <Line:1> incorrect arguments for (=)
-E- DXL: <Line:1> syntax error
-R-E- DXL: <D:\\dxl\\test.dxl:11> unassigned variable (strFilename)
-I- DXL: execution halted



Is there a better way to do this? I´m quite new to DOORS and dxl.

Thanks for your help.



 

 


hme - Mon Oct 25 04:24:40 EDT 2010

Re: Pass parameters in batch mode
llandale - Mon Oct 25 10:00:23 EDT 2010

Don't see the interpret error but suspect something is wrong with your 'cfgDxlOutputPath', you should print that. I wonder if there are enough escaped slashes.

Even when you get that working, your '-D' declaration is not accessible to your '-b' script due to context. I don't deal with 'context' like this, but your '-D' script could define your output path parameter in the 'top context' which will make it acccessible. Its likely you will need to change '-D' dxl script with '-C' cli script to run the top context stuff ahead of time, which will need to do something like this:

string dxlCli = "evalTop_(\"string strFilename = \\"\" + cfgDxlOutputPath + \"\\"\")"

string pArgs = bla bla bla "-C " + dxlCli

Its possible the 'cli' switch always puts stuff in the top context, and I'm sure someone else here will correct or clarify that for me.

  • Louie

Re: Pass parameters in batch mode
Mathias Mamsch - Mon Oct 25 11:14:34 EDT 2010

The -D string is evaluated in a separate context than the batch file, that is why the parameter won't stick.

You should declare the parameters in some temporary file and do
 

string parameter1 = "blah"
string par2 = "blub"
 
#include <myBatchFile.dxl>

 


and run this as the batch file without using the -D string. Or as Louie suggested you -D string must declare the variables on the top context using evalTop_ which will also make them accessible from the batch.

Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Pass parameters in batch mode
hme - Thu Oct 28 05:07:19 EDT 2010

The problem was the "cfgDxlOutputPath" which was backslashed only twice. As a string it has to be backslashed four times. Now it works fine.

Thank you!