I want to do this
get value from multiple select as newRefs;insert into table1 ('name') values ('pete');SELECT LAST_INSERT_ID() as newUserId;for each (currentRef in newRef) { insert into lookupTable1 (userId,ref) values (newUserId,currentRef);}
Actually there is a quicker way to do this with MySQL/MariaDB as noted here https://dev.mysql.com/doc/refman/8.0/en/insert.html
What do I need to do this?Do I use Data Store Entities, Record Types, etc.?I can't be the first one that want to do something like this.
Discussion posts and replies are publicly visible
I am not sure I understand what you try to do. Can you add a bit more details please. What did you try in Appian?
Sure.I have a multi select drop down, where the value of each drop down is the primary key of a table.
As well, I have a 'New Item' form which contains various inputs/controls.
I need to have Appian first create the new item, then get the primary key of the record that was just inserted and finally I need to add to a lookup table the primary key of the new record and the values from the multi-select dropdown.
That is part 1 adding new items.
Part 2 is similar, but it's for editing items with the possibility of the selected values in the multi-select changing when updates occur.
I know how to do all of this in a tradition programming environment (C#, Java, etc.) which only takes me about 30 minutes to do.Maybe in Appian I need to setup a MySQL/MariaDB Function/Stored Procedure?
That would be a case for a simple Appian process model. Two consecutive write record nodes store the data. The first needs to be configured (outputs tab) to store the created ID into the field of your mapping.
Do I use two different 'Write Records' or two different 'Write To Data Store Entity' or a 'Write To Multiple Data Store Entities?I don't think that you can have two different record types with 'Write Record', however you are the expert and have more experience/knowledge with Appian.
This is what I currently haveThe Add Created By adds the currently logged user into the record before writing the record to the database.
You should be able to use two separate Write Records nodes. You're correct that you cannot write too different record types within one Write Record node, but you can use two consecutive nodes to achieve what you're looking for! Like Stefan said though, just make sure you map the output from the first node so you can reference that foreign key in your second Write Records node.
Are you able to point me towards any help/documentation/tutorials on how to do this?
Sure! Here's a pretty good example in the documentation: docs.appian.com/.../Write_Records_Smart_Service.html
I've made some progress, using the example provided, however, for some reason the value is null/empty as shown in this Loom video:https://www.loom.com/share/9581aea2c2604eeb82499e94cac12da1It looks like I'm doing everything correct, so what am I missing?
Could it be that you do not store the "stored values" from the outputs tab of the first write records node back to the PV?
I suggest to do one step after the other, and also validate each step.
Assign the data coming from the interface to PVs -> Does this data show up?
Store data to the record -> Does it show up in DB?
Store stored values back to PV -> Does it do that?
.
Once you are more familiar with Appian, you might be able to skip a step or two. But even I, after 13 years do not do more than two or three steps without test and validation.