cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Can Project level parameters values be updated either through the java dll or command line inteface

rteifke
8-Gravel

Can Project level parameters values be updated either through the java dll or command line inteface

Can Project level parameters values be updated either through the java dll or command line inteface

1 ACCEPTED SOLUTION

Accepted Solutions
awalsh
17-Peridot
(To:rteifke)

Thanks for the screenshot; that makes the question a lot clearer.

You can edit the parameter values field using the "im editissue" command, but unfortunately, you have to provide the entire field contents for any updates.

So using your screenshot above as an example, if you were to update the value for a parameter named a_FV, you would also need to include the definitions and values for all the other parameters. Like so:

im editissue --field="parameter values"="a_STD_TIME_TOL_sec;description=Product

a_STD_TIME_TOL_sec;locked=true

a_STD_TIME_TOL_sec=2

p_TIME_16_HO_REL_LOW_sec;description=Product 16

p_TIME_16_HO_REL_LOW_sec;locked=true

p_TIME_16_HO_REL_LOW_sece=3.5

p_TIME_BC_BAIL_HO_LOW_MEAN_HIGH_sec;Product BC.

p_TIME_BC_BAIL_HO_LOW_MEAN_HIGH_sec;locked=true

p_TIME_BC_BAIL_HO_LOW_MEAN_HIGH_sec=0

a_Independednt_Relay_Type;description=Application

a_Independednt_Relay_Type;locked=true

a_Independednt_Relay_Type=1

p_TIME_16_DBI_HO_LOW_MEAN_sec;description=Product 16

p_TIME_16_DBI_HO_LOW_MEAN_sec;locked=true

p_TIME_16_DBI_HO_LOW_MEAN_sec=6

p_TIME_16_DBI_HO_LOW_MEAN_LOW_sec;description=Product 16

p_TIME_16_DBI_HO_LOW_MEAN_LOW_sec;locked=true

p_TIME_16_DBI_HO_LOW_MEAN_LOW_sec=2

p_TIME_16_DBI_EMERG_LOW_MEAN_sec;description=Product 16

p_TIME_16_DBI_EMERG_LOW_MEAN_sec;locked=true

p_TIME_16_DBI_EMERG_LOW_MEAN_sec=6

a_IN_OUT_Assert;description=IO

a_IN_OUT_Assert;locked=true

a_IN_OUT_Assert=ON"

a_FV;description=String Parameter

a_FV;locked=true

a_FV=new_value" 478424

You can get the current value of the fields by running "im issues --fields=parameters,"parameter values" [Item ID].

View solution in original post

26 REPLIES 26
awalsh
17-Peridot
(To:rteifke)

If you are referring to updating a Workflows and Documents project, then you can edit the project definition by using the "im editproject" command, or edit the project item by using the "im editissue" command. "im editproject" would be used to change information such as description, permitted groups and administrators. "im editissue" can be used to edit any field in the linked project item, assuming you have the correct permissions and the fields are editable. You can find more information on either command in the man pages. See KCS 154554 for more details on accessing man pages and command line usage information.

rteifke
8-Gravel
(To:awalsh)

I am referring to the parameters defined here:

IntegrityParameters.jpg

I do not have documentation for "im editproject" and I used the command line which stated the server has been locked down since 2012? Should I be able to use ineditissue for updating these? if so can you provide and example if my parameter was a string named "a_FV"

DanR.
10-Marble
(To:rteifke)

There is a field called "Parameter Values". You might check that out.

awalsh
17-Peridot
(To:rteifke)

Thanks for the screenshot; that makes the question a lot clearer.

You can edit the parameter values field using the "im editissue" command, but unfortunately, you have to provide the entire field contents for any updates.

So using your screenshot above as an example, if you were to update the value for a parameter named a_FV, you would also need to include the definitions and values for all the other parameters. Like so:

im editissue --field="parameter values"="a_STD_TIME_TOL_sec;description=Product

a_STD_TIME_TOL_sec;locked=true

a_STD_TIME_TOL_sec=2

p_TIME_16_HO_REL_LOW_sec;description=Product 16

p_TIME_16_HO_REL_LOW_sec;locked=true

p_TIME_16_HO_REL_LOW_sece=3.5

p_TIME_BC_BAIL_HO_LOW_MEAN_HIGH_sec;Product BC.

p_TIME_BC_BAIL_HO_LOW_MEAN_HIGH_sec;locked=true

p_TIME_BC_BAIL_HO_LOW_MEAN_HIGH_sec=0

a_Independednt_Relay_Type;description=Application

a_Independednt_Relay_Type;locked=true

a_Independednt_Relay_Type=1

p_TIME_16_DBI_HO_LOW_MEAN_sec;description=Product 16

p_TIME_16_DBI_HO_LOW_MEAN_sec;locked=true

p_TIME_16_DBI_HO_LOW_MEAN_sec=6

p_TIME_16_DBI_HO_LOW_MEAN_LOW_sec;description=Product 16

p_TIME_16_DBI_HO_LOW_MEAN_LOW_sec;locked=true

p_TIME_16_DBI_HO_LOW_MEAN_LOW_sec=2

p_TIME_16_DBI_EMERG_LOW_MEAN_sec;description=Product 16

p_TIME_16_DBI_EMERG_LOW_MEAN_sec;locked=true

p_TIME_16_DBI_EMERG_LOW_MEAN_sec=6

a_IN_OUT_Assert;description=IO

a_IN_OUT_Assert;locked=true

a_IN_OUT_Assert=ON"

a_FV;description=String Parameter

a_FV;locked=true

a_FV=new_value" 478424

You can get the current value of the fields by running "im issues --fields=parameters,"parameter values" [Item ID].

rteifke
8-Gravel
(To:awalsh)

Just to clarify; I have about 300 parameters. Do all 300 parameters have to be included in any update or are you just saying that for any one parameter all the fields have to be included?

FYI

I tried running your example and got Cannot have special characters ; or = as part of the "Value Description" error

awalsh
17-Peridot
(To:rteifke)

Yes, all 300 parameters would have to be included. There isn't currently a way to update just one parameter via the command line.

There is a typo in my example: the line a_IN_OUT_Assert=ON" should be a_IN_OUT_Assert=ON

Please contact Integrity Support to be added to a feature request to improve how the parameters are edited on the CLI; there's also a feature request for improved documentation that you may want to be added to as well.

rteifke
8-Gravel
(To:awalsh)

You have been very helpful. Thank you very much.

If you Omit or change the particular parameter name, can you just change it here or do you need to change it in the GUI first?

If you omit the a particular parameter wil the function error out or will it remove it from the current parameters list?

Also I assume this can be used to update any of the fields not just the parameter value?

awalsh
17-Peridot
(To:rteifke)

The field will be updated with exactly the text you enter on the CLI. If you leave a parameter out, then it will be removed from the values; if you add a new one, it will be added to the list. Editing the parameter values field does not change the actual parameters defined, though. In order to do that, you should update the Parameters field.

yes, im editissue --field="[field name]"="[field value]" [Item ID] can be used to update any field. There are also some options on editissue for specific types of fields, such as rich content, attachments and relationships.

rteifke
8-Gravel
(To:awalsh)

I have played around with this most of the afternoon and part of this morning. I have ereased all but 3 and am only using one(1) of them. I am using the following command:

im editissue --field="parameter values"="a_16_Auto_FV_Minus_10_psi;description=Product_16 a_16_Auto_FV_Minus_10_psi;locked=true;a_16_Auto_FV_Minus_10_psi='64'" 478424

My question is what separates the fields? is it space as I show or a return character? or should there be a ';' in there?

Parameters2.jpg

If I runn the above command I get Can not have special charaters ; or = as part of the Value Descripotion". error messge. I can remove the "description=Product_16" part of the command and it will run without error but it does not update the locked value or parameter value. What is wrong?

awalsh
17-Peridot
(To:rteifke)

It's a newline that separates the parameters. I was able to get this to work in a shell, but DOS or batch files are going to work differently.

rteifke
8-Gravel
(To:awalsh)

Is there documentation anywhere other than the CLI Reference for Workflos and Documents document (which could provide better information), that would explain this in much more detail?? I can try it in the dos shell but it would be nice to know how it work using a DOS box. Thank you agian for your assistance Ann!

DanR.
10-Marble
(To:rteifke)

Richard,

I have not found any other documentation. The CLI Reference is it. It can be difficult to figure out because the command line is unforgiving.

Run the GUI client and login as an admin.

Open a DOS shell (If in Windows run cmd).

Change directory to c:\Program Files (x86)\MKS\IntegrityClient\bin\

This is where you would run any im commands

im editissue --hostname=<MKS-server-hostname> --port=<port number> --field="<fieldName>=<fieldValue>"

This will get you started. I've learned how to use CLI to create hundreds of fields, triggers, queries, etc, in a matter of a few minutes.

Dan

awalsh
17-Peridot
(To:rteifke)

Unfortunately, no, the documentation for how to format the parameters and parameter values fields is sorely lacking. There is a feature request to improve this - contact Integrity Support and ask to be added to RFC 1000783 (KCS Article: https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS188625&lang=en_US).

I'm actually using the kornshell, rather than a DOS shell because I'm a lot more familiar with scripting with ksh.

Anyone else have a hint on how to get multi-line to work for commands or variable in DOS?

Another option might be to use the Java API, as I'm pretty sure you can do multi-line variables in Java, and im editissue is a supported command.

DanR.
10-Marble
(To:awalsh)

In DOS variables like such:

Variables

SET HOST=--hostname=mks-test

SET CF=createfield

SET CMDG=createmksdomaingroup

SET EMDG=editmksdomaingroup

SET CP=createproject

SET CQ=createquery

SET CR=createreport

SET CS=createstate

SET CT=createtrigger

SET EF=editfield

SET EG=editgroup

SET EP=editproject

SET ET=edittrigger

DOS Command line im

im %CS% %HOST% --name=%STATE01% --description="blah blah"

To loop

FOR /L %parameter IN (start, step, end) DO (<insert you CLI script here>)

FOR /L %X IN (1, 1, 9) DO (<CLI Script>)

rteifke
8-Gravel
(To:DanR.)

Dan,

I don't think this will work for me. I tried using this command set: "im createfield" to get the help for it and I got "server locked by System" error message. I think I need to use the editissue command as Ann has stated...but I am unable to figure out what needs o separate the fields in DOS. Ann has suggested using the Java dll, but I have not been able to use that dll. I was hoping there was a dll for C#, but have not seen that anywhere?

I tried using the C# DOS window interface which does work with commands like create content but I can run them in a DOS box first to verify they work. This particular command(edit issue) does not work correctly in the DOS window. It only allows me to update one field of a parameter list and erases all other parameters in the list at that time.

If you are certian the createfield will allow me to update the existing parameter list one item at a time I can ask the IT department to allow usage of that command. from what I see in your example I am not sure that it will?

DanR.
10-Marble
(To:rteifke)

createfield will NOT allow you to update. You would need to use editfield. Because you are changing an existing field and not creating a new field.

awalsh
17-Peridot
(To:DanR.)

In this case, he is updating the values of a field in a particular item, rather than the field definition, and so editissue is what is needed.

DanR.
10-Marble
(To:awalsh)

In that case you would need to do something like this:

im editissue --query="<Name of query with issues to update>" --field="<fieldName>=<fieldValue>"

rteifke
8-Gravel
(To:DanR.)

Dan,

With the following screen capture:

Parameters3.jpg

And the blown up version:

Parameters4.jpg

Could you provide the exact command text to update both of these parameter values for both the parameter value and value description?

if they can be done in two single line commands that would work for me two?

Thank you for your patience

Stackoverflow has a good page on how to enter multi-line commands in DOS:

cmd - Long commands split over multiple lines in Vista/DOS batch (.bat) file - Stack Overflow

Long story short, you need to use the carat character (^).

I saw that site and tried that with no luck.

I am currently trying the C# API calls, but I am runing into an issue there:

APIFactory.MKSInitialize();

ip = APIFactory.CreateIntegrationPoint("mks.corp.knorr-bremse.com", 7001, false, 10, 5);

lip = APIFactory.CreateLocalIntegrationPoint(true, 4, 13);

session = ip.CreateSession(<user name>,<password>);

Command issuesView;

issuesView = new Command(Command.IM, "viewissue");

issuesView.AddSelection(<NUM>);

cr = session.CreateCmdRunner();

r = cr.Execute(issuesView);

This give me a "API communications error. A first chance exception of type 'MKS.ManagedAPI.APIConnectionException' occurred in MKS.ManagedAPI.dll " error

If I change it to

APIFactory.MKSInitialize();

ip = APIFactory.CreateIntegrationPoint("mks.corp.knorr-bremse.com", 7001, false, 10, 5);

lip = APIFactory.CreateLocalIntegrationPoint(true, 4, 13);

session = lip.CreateSession(<user name>,<password>);

Command issuesView;

issuesView = new Command(Command.IM, "viewissue");

issuesView.AddSelection(<NUM>);

cr = session.CreateCmdRunner();

r = cr.Execute(issuesView);


I get a "
A first chance exception of type 'MKS.ManagedAPI.NoCredentialsException' occurred in MKS.ManagedAPI.dll

Authentication failed for teifker on mks.corp.knorr-bremse.com:7001"

Any suggestions?

I see a couple problems here. First, you are trying to create both a server integration point and a local integration point (using a local client):

ip = APIFactory.CreateIntegrationPoint("mks.corp.knorr-bremse.com", 7001, false, 10, 5);

lip = APIFactory.CreateLocalIntegrationPoint(true, 4, 13);


You only need one of those.

Second, it looks like you're using the wrong API version for the server integration point. Where the line above says: "10, 5" it should really be "4, 13" for the Integrity 10.5 API version.

I made a change to:

APIFactory.MKSInitialize();

ip = APIFactory.CreateIntegrationPoint("mks.corp.knorr-bremse.com", 7001, false, 4, 13);

session = ip.CreateSession(<user name>,<password>);

Command issuesView;

issuesView = new Command(Command.IM, "viewissue");

issuesView.AddSelection(<NUM>);

cr = session.CreateCmdRunner();

r = cr.Execute(issuesView);

and now I get "A first chance exception of type 'MKS.ManagedAPI.CommandCancelledException' occurred in MKS.ManagedAPI.dll"

Any more thoughts?

I'm not familiar with the C-API but does the sample code in this article help?

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS161216


That is C, however there is a C# version https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS159452 and this code snipet actually works ok, it when I try to use some other command. I think anyone can view the about information so I thin that is why it works ok.

Is there any documentation for use of C# anywhere in PTC? I got this document number from another thread, in which Nan Sun replied, would he be the person I would need to ask about C#?

The documentation we have available is in the Integrations Builder Guide but the sections talking about the C-API are pretty small and didn't seem overly helpful to me.

You could try sending a message to Nan (Neil) Sun through the community or you could open a case with PTC Technical Support to look into that error message.

Top Tags