Altair Posted August 8, 2019 Report Share Posted August 8, 2019 My first approach was get the count of the table but then I realized that it wasn’t including the newly added fields. Can someone guide me on this? Quote Link to comment Share on other sites More sharing options...
0 Nuke354 Posted August 8, 2019 Report Share Posted August 8, 2019 What you can do is use this task trigger config as a template if you want to combine the old table data plus the newly inserted data. With this, you can different sorts of operations and to manipulate values (pre-insert values and post-insert value) using a trigger upon insert. Quote Link to comment Share on other sites More sharing options...
0 Glitch Posted August 9, 2019 Report Share Posted August 9, 2019 First question is, how are you counting the records. Do you have a parent table where the counter is going to be saved? The reason why the inserted record is not being counted, because if you do the Select count on the trigger - the trigger will be counting the records that are currently inside the table. So when it comes to counting or summing the values, you need to include the #inserted value. Or in this case, you can just simply add 1 to the Select Count query. Hope this helps. Glitch(); Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted August 28, 2019 Report Share Posted August 28, 2019 The last inserted value gets to a temporary table before it gets added to the actual table so you need to count the number of rows of #inserted as well and add it to the rest Quote Link to comment Share on other sites More sharing options...
0 KG360 Posted May 23, 2023 Report Share Posted May 23, 2023 I took a slightly different approach, by counting the existing distinct records in the target table and adding 1 if the distinct record value does not already exist, and combining it with a very simple triggered action, like this as in my test app: In the form, I added the 'Count' field: (SELECT COUNT (DISTINCT Perspective) FROM CasePerspectives WHERE CaseID=target.[@field:CaseID]) + [@cbParamVirtual1] And a virtual field Virtual 1: CASE WHEN (SELECT COUNT (DISTINCT Perspective) FROM CasePerspectives WHERE CaseID=target.[@field:CaseID] AND Perspective = target.[@field:Perspective]) = 0 THEN 1 ELSE 0 END The 'Count' value will then be the number of distinct values in the last saved record. The following triggered action in the target table: Quote Link to comment Share on other sites More sharing options...
0 Flowers4Algernon Posted May 27, 2023 Report Share Posted May 27, 2023 Hello! Just wanted to share this how-to link should you guys want to read more about Triggered Actions: https://howto.caspio.com/tables-and-views/triggered-actions/ KG360 1 Quote Link to comment Share on other sites More sharing options...
0 KG360 Posted May 28, 2023 Report Share Posted May 28, 2023 22 hours ago, Flowers4Algernon said: Hello! Just wanted to share this how-to link should you guys want to read more about Triggered Actions: https://howto.caspio.com/tables-and-views/triggered-actions/ Thanks, I have read it a few times, but might need it once more. I would like a more comprehensive description of triggered actions, also the more complex! Right now I need a triggered action that recounts a number when a distinct value of another field is removed.. Quote Link to comment Share on other sites More sharing options...
Question
Altair
My first approach was get the count of the table but then I realized that it wasn’t including the newly added fields. Can someone guide me on this?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.