Hi all, I try in create master data from sql insert WITH OUT use excel importer, the data can insert on entity as well and my applicatioon can select them from dropdow m but , after that entity has relation with another entity I got message Some(Collateral)' should not be null after i switch to import from excel importer it is working very well, how to import master data with out excel import , I focus on SQL insert. how to generate the value for column “id” INSERT INTO ems."master$deed" ( id, Code, "desc") VALUES ( 1,'AAA', 'AAA'); INSERT INTO ems."master$deed" ( id, Code, "desc") VALUES ( 2,'BBB', 'BBB'); INSERT INTO ems."master$deed" ( id, Code, "desc") VALUES ( 3,'CCC', 'CCC'); INSERT INTO ems."master$deed" ( id, Code, "desc") VALUES ( 4,'DDD', 'DDD'); INSERT INTO ems."master$deed" ( id, Code, "desc") VALUES ( 5,'EEE', 'EEE');
asked
Somboon Srisamanuwat
3 answers
1
A very simple way to get static masterdata into your application is to feed a JSON via a string-variable to an importmapping. The mapping will do all the hard work for you.
So:
create an entity having attributes ‘code’ and ‘desc’ (no need for id, Mx will take care of that)
Create a JSON-element: [{“code”:”AAA”, “desc”:”aaaa”}]
Create an import mapping using this JSON-element as source
Create a microflow;
Create string-variable having value [{“code”:”AAA”, “desc”:”aaaa”}, {“code”:”BBB”, “desc”:”bbbb”}, {“code”:”CCC”, “desc”:”cccc”}]
Feed that variable to your import mapping.
Tadaaahhh
answered
Tim v Steenbergen
0
Every entity has an unique id, which is hidden in domain model and managed by Mendix itself. Does it help you to add an extra AutoNumber column?
answered
Henri Schellingerhout
0
Hi Somboon,
One way of importing initial set of data is to create an API which will accept the request coming from e.g. Postman. Potentially this can me a REST service which will accept a collection of records and will process those within Mendix. This will require a simple mapping to your entities and should work perfectly for your case (provided that you consider other methods of filling in the initial tables).