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

adding a column into the existing infotable through service

KSM
Amethyst

adding a column into the existing infotable through service

I want to add a column to the info table and as well as data shape which is associated with this info table.

result.AddField({name : "isSubScribed", baseType : "BOOLEAN"});

it is added in the infotable and name is displaying on all rows. and my datashape is also not updated with this field definition. I dont want to display name on all rows and datashape should be updated with that field definition

3 REPLIES 3

Re: adding a column into the existing infotable through service

the output of a infotable is shown in the image.

 

Re: adding a column into the existing infotable through service

You will need to add the field to the DataShape itself by calling the AddFieldDefinition service on the DataShape entity. You might want to check if the field already exists before adding it, if you are planning to call this service multiple times

 

You may or may not need to add the field to the InfoTable, as in your example, depending on how the InfoTable is created (i.e. is it created from the DataShape? Did you add the field to the DataShape before creating the InfoTable? If so, it will already be there).

 

 

Here is an example:

 

 

//probably you want this to be at the end, so get a count of your fields on your InfoTable
//ordinals are zero indexed so the length should be okay, no need to increment it
var ordinal = Object.keys(infotable.dataShape.fields).length;
var fieldName = "FieldName";

if
var params = { name: fieldName /* STRING */, description: undefined /* STRING */, type: "BOOLEAN" /* BASETYPENAME */, ordinal: ordinal /* INTEGER */, primaryKey: undefined /* BOOLEAN */, dataShape: undefined /* DATASHAPENAME -- only for InfoTable types */ }; // no return DataShapes["DataShapeName"].AddFieldDefinition(params);

 

 

Generally, though, there is very little reason to try to dynamically append fields to a DataShape at Runtime, you should only have to create the DataShape once (which can be done programmatically, as in the above example), but you would want that to be a separate service than the one that is returning the InfoTable. What is the use case you are trying to solve?

Re: adding a column into the existing infotable through service

Hi James,

Thx for ur reply.

 

I am able to add the field into my datashape and when i run that service i get that wired result which was shown in attached image. when i created mashup for that service, am unable to display that column issubscribed on mashup screen,

My requirement is i want display that column issubscribed with checkboxes in all rows on mashup. next whenever I will check the selected rows on mashup one clicked event will trigger and calls another service when I need to subscribe those data and send an e-mail to the user.