Skip to main content
1-Visitor
April 5, 2018
Question

creating datashape and its fields in runtime

  • April 5, 2018
  • 1 reply
  • 2858 views

hi

how to create the datashape and its fields by giving the fields and its basetype in runtime based upon the data from csv file.

thanks

1 reply

5-Regular Member
April 5, 2018

Hi @achitters have you already seen the CreateDataShape service available in the Resource EntityService, you'll have to map the column headers from csv to the fields that can be passed to the fields in this CreateDataShape()

 

05-04-2018 10-16-03.jpg

achitters1-VisitorAuthor
1-Visitor
April 5, 2018

the datashape is already created in runtime  and unable to set the primary key and basetype of the field in runtime.

5-Regular Member
April 5, 2018

I believe that should be doable with the UpdateFieldDefinition() , eg.

 

 DataShapes["DemoDS"].UpdateFieldDefinition({
	name: "Field1" /* STRING */,
	description: undefined /* STRING */,
	type: INTEGER/* BASETYPENAME */,
	ordinal: undefined /* INTEGER */,
	primaryKey: true/* BOOLEAN */,
	dataShape: undefined /* DATASHAPENAME */
});