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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How to set Default Value to the data shape field through pragmatically?

Sugumar_5656
14-Alexandrite

How to set Default Value to the data shape field through pragmatically?

I like to set default value for the boolean data shape field.

 

can anybody explain how to do this?

 

Regards

Sugumar R

 

ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

You can use  aspects parameter similar to below to achieve your requirement

 

var params = { infoTableName: undefined /* STRING */};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].CreateInfoTable(params);

//Add a new field to the InfoTable:
result.AddField({name: "ColNameOne", baseType: "BOOLEAN", aspects : {defaultValue:1}});
result.AddField({name: "ColNameTwo", baseType: "INTEGER", aspects : {defaultValue:10}});
result.AddField({name: "ColNameThree", baseType: "STRING", aspects : {defaultValue:"test"}});

result.AddRow({});

View solution in original post

2 REPLIES 2

Hi,

 

You can use  aspects parameter similar to below to achieve your requirement

 

var params = { infoTableName: undefined /* STRING */};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].CreateInfoTable(params);

//Add a new field to the InfoTable:
result.AddField({name: "ColNameOne", baseType: "BOOLEAN", aspects : {defaultValue:1}});
result.AddField({name: "ColNameTwo", baseType: "INTEGER", aspects : {defaultValue:10}});
result.AddField({name: "ColNameThree", baseType: "STRING", aspects : {defaultValue:"test"}});

result.AddRow({});

slangley
23-Emerald II
(To:vinakumar)

Hi @Sugumar_5656.

 

If you feel the previous response answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Thank you for your participation in our community!

 

Regards.

 

--Sharon

Announcements


Top Tags