Skip to main content
May 9, 2023
Question

A new row is inserting whenever write to data store is happening.

  • May 9, 2023
  • 9 replies
  • 0 views

Hi,

After every user input task completed i have called write to data store entity to insert data to table so over all in main process i have called three times so after every user input task a new row creating the values is not getting updated but after every user interaction a new row is getting inserted. i have updated the details correctly like below in input and also in output tab i stored the ac values to cdt. kindly suggest me on this and autoincrement i have given to Id column in cdt

Query:

9 replies

May 9, 2023

if you want to update a existing row, you have to send the Primary Key value in your inputs.. 

If you dont send this, appian inserts a new record. 

May 9, 2023

I have defined I'd value only as primary could you please let me how to pass that value as input

mikes0011
Brainy
May 9, 2023
also in output tab i stored the ac values to cdt

Can you confirm from your running process instance that the stored PV value contains the Primary Key ID autogenerated in the new inserted row?  Also can you verify that you have the primary key ID column set to AUTO_GENERATE in the DB (or, alternatively, that you're populating one manually)?

The Expression Guru
May 9, 2023

Thank you for the details

running process instance primary key id pv is not having the value while inserting to db only id was generating in db i didnot provided as auto generated but in cdt while creating for that id column provided as auto generate

May 9, 2023
primary key id pv is not having the value

That's why a new entry is getting created, to update an existing record you need to ensure that your pv!Division_Hierarchy_Details is having the primary key id populated before WDSE i.e., when you are saving the value in this pv! from UIT node input.

Also, there is no point passing the pv! in saveInto (from the screenshot) in this case, just save the stored values from node output in the pv!.

May 12, 2023

Header the user to a new page :

if (isset($_POST['submit']))
{
$user= $_POST['username'];
$email = $_POST['useremail'];
$pass= $_POST['password'];

mysql_query("INSERT INTO table (username, useremail, email) VALUES(`$username','$useremail','$email')");

}
//best outside the if statement so user isn't stuck on a white blank page.
header("location: landing_page.php");
exit;

By doing this the user who refreshes will be refreshing landing_page.php which means it won't do the insert twice.

Best advice: do a check to see if user exists first if so don't insert!

mikes0011
Brainy
May 12, 2023

How is this relevant to an Appian process?

The Expression Guru