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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

cannot add rows to InfoTable session variable

KK_9150368
5-Regular Member

cannot add rows to InfoTable session variable

I have an infotable session variable called  testsessvar,  it is defined with a datashape (containing 2 text fields:  Doc_Name,  Doc_URL)

 

on the server side I have a service defined as follows

{

input  newinfotable_entry     (using same dateshape as the one the session variable uses)

tmp = Resources["CurrentSessionInfo"].GetGlobalSessionValues().getRow(0).testsessvar;

tmp.AddRow(newinfotable_entry);

result = tmp;

}

 

the output of this service is connected with the session variable in the mashup (so the update of the session variable is being done on the client side,  I have also tried to update it in the script with same result)

The idea is to be able to continually add rows to the infotable session variable

 

unfortunately the only thing being added is empty objects (the below image shows what gets returned from

the above service)

 

KK_9150368_0-1634743269038.png

 

This second image shows the input value of newinfotable_entry

 

KK_9150368_1-1634743694399.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @KK_9150368,

 

I have attached some example entities that shows adding rows to a session variable.  I am not exactly sure why your example is not working but in mine I passed in the info table session variable to my service to add rows.

 

If you are updating session variables via the session tab in a mashup ( client side ) it is best to pass this variable into your target service instead of using: "Resources["CurrentSessionInfo"].GetGlobalSessionValues().getRow(0).testsessvar".  The resources gets session variables server side.

 

Thanks,

 

Travis

View solution in original post

6 REPLIES 6
KK_9150368
5-Regular Member
(To:KK_9150368)

BTW,  the 2 versions of TWX if have tried this on are:   9.2.0-b30  and 9.1.0-b10877

M4RC
14-Alexandrite
(To:KK_9150368)

I am not a professional, but when adding values, I assign the row-values individually.

 

Like this:

tmp.AddRow({

      Doc_Name: newinfotable_entry.Doc_Name,

      Doc_URL: newinfotable_entry.Doc_URL

)};

 

I hope this helps

Best regards

KK_9150368
5-Regular Member
(To:M4RC)

I actually tried that also to no avail

Hi @KK_9150368,

 

I have attached some example entities that shows adding rows to a session variable.  I am not exactly sure why your example is not working but in mine I passed in the info table session variable to my service to add rows.

 

If you are updating session variables via the session tab in a mashup ( client side ) it is best to pass this variable into your target service instead of using: "Resources["CurrentSessionInfo"].GetGlobalSessionValues().getRow(0).testsessvar".  The resources gets session variables server side.

 

Thanks,

 

Travis

KK_9150368
5-Regular Member
(To:TravisPickett)

Travis,

 

     Thanks for the info.  I decided to use a data table instead.   I will keep this for future reference

slangley
23-Emerald II
(To:KK_9150368)

Hi @KK_9150368.

 

It sounds like your question was answered to your satisfaction.  If so, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags