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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Editable Temporary InfoTable in Mashup

ptc-6292144
3-Visitor

Editable Temporary InfoTable in Mashup

Hello,

I am looking to have a service create a blank infotable and then put that infotable into a grid in a mashup. I then want to allow uses to add or delete rows within that temporary infotable from the mashup.

I have tried to accomplish this but I am getting mixed up in how to have the infotable in the grid refreshed after adding or deleting a row using services.

Any direction would be helpful.

Thank you,

Mike

5 REPLIES 5
adam11
5-Regular Member
(To:ptc-6292144)

Hi Mike,

Would you mind explaining the use case for this temporary InfoTable?

Adam,

Looking to have a 'add' and 'remove' function for certain options in a list on a mashup and I want those choices to then be filled in to a table to visualize the options the user has selected. Once they are done choosing, they will hit a submit button and those choices will be permanently added to a different table.

Thank you,

Mike



adam11
5-Regular Member
(To:ptc-6292144)

Mike,

Keep in mind, when modifying an

InfoTable

you need to pass the entire

InfoTable

 to the

Service

 adding or deleting rows. Presumably, you'll use two

Services

, one to add and one to remove a row, which will require you to pass the resulting

InfoTable

 back and forth between the two

Services

.


Here's sample code for an AddEntry() 

Service

 which takes an

InfoTable

 and two strings as input:


// If no InfoTable exists, create one

if (!myInfoTable) {

  result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({

    dataShapeName: "EntityList",

    infoTableName: "myInfoTable"

  });

  

  // Add row to InfoTable

  result.AddRow();

}


else {

  // Otherwise, add row to InfoTable and return it

  myInfoTable.AddRow({ name: name, description: description });

  result = myInfoTable;

}



Adam,

I took your advice and I have the services setup, however the inputs being brought into the service aren't being added to the table. The service adds a row, but it just lists a blank row. I have put my code below. The "Add_Vocabulary_Term" and "Selected_Add_Tag" are string inputs from another part of the mashup (lists that our bound from the selected row). Selected_Tag_List is the table being brought in.

if(Add_Boolean==true){
    Selected_Tag_List.AddRow({
        Vocabulary: Add_Vocabulary_Term,
        Term: Selected_Add_Tag
    })
    var result=Selected_Tag_List
    }
else if(Remove_Boolean==true){
   var tableLength = Selected_Tag_List.getRowCount();

for (var x = 0; x < tableLength; x++) {
    if(Selected_Remove_Tag==Selected_Tag_List.rows.Term){
        Selected_Tag_List.RemoveRow(x)
    }
}
    var result=Selected_Tag_List
}
       



Adam,

I took your advice and I have the services setup, however the inputs being brought into the service aren't being added to the table. The service adds a row, but it just lists a blank row. I have put my code below. The "Add_Vocabulary_Term" and "Selected_Add_Tag" are string inputs from another part of the mashup (lists that our bound from the selected row). Selected_Tag_List is the table being brought in.

if(Add_Boolean==true){
    Selected_Tag_List.AddRow({
        Vocabulary: Add_Vocabulary_Term,
        Term: Selected_Add_Tag
    })
    var result=Selected_Tag_List
    }
else if(Remove_Boolean==true){
   var tableLength = Selected_Tag_List.getRowCount();

for (var x = 0; x < tableLength; x++) {
    if(Selected_Remove_Tag==Selected_Tag_List.rows.Term){
        Selected_Tag_List.RemoveRow(x)
    }
}
    var result=Selected_Tag_List
}
       



Top Tags