Hello ,
I've created an enumeration and I'd like to know how I can manipulate the elements of this enumeration in Javascript (for example add/delete/modify elements of this enumeration), but in Javascript
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Sure!
Given this enumeration as an example:
You can insert a line here with the following code:
// insert into enumeration
var sqlFields = "INSERT INTO campaign_dev_DB.neolane.XtkEnumValue (iValueId, iEnumId, sLabel, sName)";
var sqlValues = " VALUES(GetNewId(), 15131, 'Inserted from Javascript', 'insertedFromJS'))";
sqlExec(sqlFields + sqlValues);
The end result will be:
Note: Take into consideration that you need to find a new ID for each line if you want to insert. Depends on the client setup.
You might need to query xtkNewId to get a new ID (and then increase it!):
select IdSeed XtkNewId where sSequence = 'xtknewid';
Other operations such as edit values, remove values, can also be done via SQL in JavaScript.
Hello,
You can use sqlExec (or other sql functions) to manipulate the table xtkEnum and xtkEnumValue, where all enumerations are stored.
Views
Replies
Total Likes
hello @jorgeferreira ,
thank you for your reply,
I would like to know if there is a possibility of a small example please.
Views
Replies
Total Likes
Hi,
Sure!
Given this enumeration as an example:
You can insert a line here with the following code:
// insert into enumeration
var sqlFields = "INSERT INTO campaign_dev_DB.neolane.XtkEnumValue (iValueId, iEnumId, sLabel, sName)";
var sqlValues = " VALUES(GetNewId(), 15131, 'Inserted from Javascript', 'insertedFromJS'))";
sqlExec(sqlFields + sqlValues);
The end result will be:
Note: Take into consideration that you need to find a new ID for each line if you want to insert. Depends on the client setup.
You might need to query xtkNewId to get a new ID (and then increase it!):
select IdSeed XtkNewId where sSequence = 'xtknewid';
Other operations such as edit values, remove values, can also be done via SQL in JavaScript.