Skip to main content
Apr 5, 2018 6:29 AM UTC
Question

creating datashape and its fields in runtime

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

3 replies

Apr 5, 2018 8:19 AM UTC

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

achittersAuthor
Apr 5, 2018 8:49 AM UTC

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

Apr 5, 2018 9:31 AM UTC

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 */
});