Expression Rule Issue

Hi,

 

I have an requirement where i need to compare data from existing data in DB.

Example;

Table A having 1000 records. On UI i am showing some records(20) on basis of some filter criteria(2 Colmuns) . Now I am modifying 5 records (Update/Delete).

I need to put validation that combination of these two columns should be unique in DB.

Either i can do put validation on UI or through expression rule i can check in DB.

 

Please share some approach code on that. If possible can anyone share sample code also .

 

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Create a query entity that filters on both of the columns equals one pair values you're comparing. You'll know the values are available for use if the length of your result set is 0. You'll know it's used if the length is 1, and that you have a bug if it's ever greater than 1. You can run forEach on this rule (or apply if you haven't got forEach) to run it on all of your value pairs.

    I would also add a unique key utilizing both of those columns in the DB for safety. ALTER TABLE yourTable ADD UNIQUE aliasOfYourChoosing (column1, column2). If something should happen and Appian attempts to break uniqeness with a DB write (which would be an Appian bug) it will hang on that node and the process won't complete rather than ruin your uniqueness requirement. You'll know where the Appian bug is right away and can begin correcting.
  • Can we use same dataset which we extract initially. Actually to display at UI i am fetching all records through PM to Interface and then further passing to another rule after passing required filter. In that can i use master data set n filter dataset and then compare head to head rows ?
Reply Children
No Data