Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
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
Hi Mike,
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
Mike,
Keep in mind, when modifying an
InfoTable
you need to pass the entireInfoTable
to theService
adding or deleting rows. Presumably, you'll use twoServices
, one to add and one to remove a row, which will require you to pass the resultingInfoTable
back and forth between the twoServices
.Here's sample code for an AddEntry()
Service
which takes anInfoTable
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
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
Selected_Tag_List.RemoveRow(x)
}
}
var result=Selected_Tag_List
}