Jump to content

Search the Community

Showing results for tags 'trigger'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location


Interests

Found 16 results

  1. I am trying to configure SMS action in trigger. But upon testing, it does not work. Below is a screenshot. Any help would be appreciated.
  2. Do records inserted through REST API execute triggered actions?
  3. Are file data types available in trigger?
  4. Hi, Does anyone know how I can create a trigger to delete records in a table that are older than say 10 minutes? I can do this easily with SQL statements but can't get my head around how to do this in the drag-and-drop screen for triggered actions. thanks. John
  5. I'm trying to create a trigger that will add fields to a bunch of related tables based on the new CCTAproject_id that is entered on the parent table. It won't let me get rid of the ID field for some reason so I'm guessing that is a necessary field. My solution was to take the max existing value in the ID field and add a 1, so that new records increase sequentially by 1. I get an error when using this method, "Column '#inserted.CCTAproject_id' is invalid in the select list because it is not contained in either an aggregate function of the GROUP BY clause, (error code: SQL8120). But if I remove the number block containing the "MAX etc" and just leave it to equal a static number, the trigger works. I don't understand what the error means by grouping since the ID field is an integer and I'm not trying to group different field. Is there a way to manipulate the trigger so the numbers can increased based on existing values?
  6. I am new so please excuse my SQL ignorance: My trigger is working, EXCEPT for the fact that it is NOT INCLUDING the most recently inserted value in the CommentHRS field in the sum (CA_TOTALhrs). Trying to be clear here: It's properly calculating the SUM on the insert event, but just not including the newly inserted value as part of the sum. (The actions with the red X work fine. No problems there.) Why would it not include the value that was just inserted in the SUM? Thanks. Mike
  7. I am trying to craft a trigger that will sum inserted rows (multiple rows) and put the total in another table. I cannot seem to find a way to select multiple rows from the #inserted table though. To explain further, I have three tables, Master, Details, Totals. When a new row is inserted into the master table an insert trigger fires on the master table and several detail rows are copied from a template table into the detail table, where each row contains a price and quantity. The price and quantity are multiplied to create a total for each row through a formula field in the details table. On the details table there is a triggered action that on insert, update or delete will sum the cost of the total formula column for all rows and put that total into a totals table. I have to sum the #insert and existing detail rows separately and add them together to get the total. This all seem to work well when inserting one row but when inserting multiple rows only the first row from the #inserted table is totaled. That makes sense because the trigger on the detail table doing the sum specifies Select top 1 from #inserted when summing. However, I need to sum multiple rows from #inserted and the trigger is not letting me remove the top 1 clause stating that it only expects one row from the select query. I have tried putting the select query for the inserted table within a sum block and alternatively putting a sum expression on the result of the select query. In both cases the trigger will not save stating that the select must specify top 1. I have attached some screen prints of what I am doing in the trigger and the issues with each scenario. TriggerValidationError.docx
  8. I'm looking to only insert unique values within a record on update with a trigger. Right now I have two tables set up with a trigger on insert/update. When a user updates a field within the Employee's table, it copies all of the information from the current record into the Employee History table. However, my users want to be able to see what fields were modified within the Employee History table. The trigger currently just copies all fields (and values in those fields - most are text) from the current Employee's table to the Employee History table. The user then can compare the current record in the employee's table with the employee history records and manually scroll through to find what values in each field are different, but this takes quite a bit of time. I would like the trigger to look at all the current values in the fields it is going to copy, if the values have not been changed (or are equal to the current values in the Employee History table), then do not update/insert those fields in the employee history table; otherwise update only the fields that have been changed. This would ideally show only updated field values for each history record, instead of duplicating all of the field values. Thank you for any assistance!
  9. Hi to everybody. I have a problem. I need a table, and relative DataPage insert data than can insert data of more than one customer. In just one data Page i need to accept customer1 and customer2 data (name, surname, address, email, phone ecc) Now the problem is that i need to have the 2 customers, NOT in a table with unic horizontal line, but listed, with new id but with the same booking number, for a new record in the table. I think i need a new table but i can't be able to make triggers to copy data in a new table and records automatically (if that is the right way). (Ex. of the table/dataPage i have) ID_ booking | booking_number | n_of_ customer | Customer1_name | customer1_surname | customer2_name | customer2_surname| 1 56789 2 John Doe Mary Harris 2 56790 1 Micheal Lewis 3 56791 2 David Clarke Rose Smith (ex. of what i need) 1 56789 2 John Doe 2 56789 Mary Harris 3 56790 1 Micheal Lewis 4 56791 2 David Clarke 5 56791 Rose Smith How can i do? Thank you for your time in advance.
  10. I'm looking for information about the "expression" feature within triggers. I have not been able to find anything other than a reference to expression aliases in the Caspio Bridge 12.0 release notes. https://howto.caspio.com/release-notes/caspio-bridge-12-0/ " Expression names can now be renamed for easier reference in other areas. " " When saving or validating a Triggered Action, incomplete expressions in a SELECT block will be automatically removed. " I discovered the feature when working with a select statement embedded in an If statement. I assume these expression alias can be used elsewhere in the trigger code. Unfortunately, I have not found a means to use them. I created the following in an attempt to figure out how to use the "expression" feature. The IF block passes validation. I saved it along with additional code that modifies the inserted record (see below). Caspio doesn't complain about the simulated no operation (NOP) I created by using an IF 'exists' comparison for select statement return value This is a far as I have been able to reverse engineer the "expression" features. I have tried to access the alias (Var1, Var2, and Var3) elsewhere in the trigger withing many different contexts. I tried within the IF and THEN clauses where they are defined. I tried within subsequent Update and Select statements. etc..... Use Case I have a table that tracks eight different topic scores and an award for each topic by person. Awards qualifications for each topic are based on several factors (topic, score, when scored, gender, and age). The scope and qualification factors for each award are contained in a reference table. I implemented the triggers needed to identify and update or insert the correct the awards. It works as expect. A different qualification/criteria row may apply to identify the correct award for each topic for any person. Without going into all of the details you will not be able to identify whether or no the data has been properly normalized. You will have to trust me that it has been. Besides, I have other use cases that would benefit from variables. There are ten large Update statements used to the identify the award for each topic as well as updating summary awards in another table. The logic is complex enough along with the size of each update statement that maintenance of the code will be cumbersome and error prone. In fact, I haven't yet combined them into one update and insert trigger. I am concerned about perfomance due to the number of select and join statements. I would rather clean this up using something like variables before deploying them in one update and insert trigger. Ideal Solution Ideally, I could use variables to gather the criteria based on context for the person and use them within subsequent IF statements. This would significantly shorten the length and complexity of the trigger. Based on my reading of forum posts, Caspio help documentation, and viewing of YouTube videos I am nearly certain that triggers do not support variables. Except that maybe "expressions" within triggers could solve my problem. An Example I included the following to help the reader better understand the ideal solution that trigger "expressions" may solve. The following test uses dummy columns to hold values for use in the trigger. I think this is a dangerous kludge. I am not using this method in my production triggers. For example, three dummy columns called "ShortCountryCode", "NumbersTests", and "TextTests" were added to the table. TextTests is assigned the value from the CountryCode field in the first Update statement. It is used in the next Update statement as part of a concatenated string to update the ShortCountryCode field. TextTests is assigned the string "SumeGamaa" in the last Update statement. The NumbersTests column is used to execute the trigger from the datapage. Ideally, variables would be used instead of dummy columns. Here is the entire trigger with the test "expression" code. The IF statement that uses three expressions is not used in the last three Update statements. Note that Caspio doesn't complain about this trigger. I have attached the table and a datapage I used for my testing. The data is public domain that I downloaded from https://www.kaggle.com/ sb_dp_internet_country_codes_2018-May-13_1706.zip sb_t_internet_country_codes_2018-May-13_1705.zip
  11. Hi, I have a trigger that has been functioning for well close to two months without issue. Suddenly, the trigger is failing to validate or push/delete information to the specified table. Upon review I'm now receiving this error message 2031 "Datasource field is invalid because it's name is absent" is a where clause. This is strange since no changes have been made to the trigger or the tables. The datasource fields are present which is why they are able to be selected. I tried to research the error but it seems to be general in nature. Also, the same datasource fields are being used in a where clause elsewhere in the same trigger without issue. Any direction that can be provided would be much appreciated. This is a MASTER trigger that provides the backbone of my application for all intensive purposes. Thanks, Bre
  12. Hi everybody, I'm new to Caspio and I have my first issue with a trigger, not working as expected. Would appreciate your help here. I have simplified things as much as possible - 2 tables Trips and Legs, one-to-many relationship TripID to LegID. The idea is that a trigger action sums the leg's mileage to the trip's total mileage. Below are both tables' design and data, as well as the triggered action. The issue is that action sums only the existing leg mileage values, but not the newly inserted/updated ones. We have a total trip mileage of 95, instead of 100. Thank you
  13. I am trying to add via an Insert trigger a second row of data, based on the first row of data which is inserted by a trigger associated with another table. The Awards table has an start date and end date of the project, and on insert creates the first milestone in a Milestone table, based on the entered start and end dates for the Award. On insert of the first milestone, I would like to add (if at all possible) a second milestone if the remaining period for the period is bigger than 12 months (which is calculated in a formula field in the first record). I get a "Triggered Action cannot be enabled because it exceeds maximum nested level of 1" Error message. Any help appreciated
  14. Hi guys, I have what will probably be a simple question but I can't seem to work it out. Essentially I have a Checkbox called ConstructionContractAvailable? and what I would like to have happen is when a field called Prime Contractor is not blank that Checkbox will uncheck. All of this is in the same table and datapage. When I try it I get the Recursive Call warning. All I want is when there are words in the section called Prime Contractor the checkbox unchecks itself. Is this possible? I've included a picture of what I did (that didn't work). Any advice would be great.
  15. Hi, I have a table that I need to update records related to the ID value when a new record is inserted. When a new record is created a field called 'InvoiceID' stores (via parameter passing) a value. That value might be used multiple times in the table (for example, this is a Payments table linked to an Invoice table. The InvoiceID (unique- one) from the Invoice table is stored (many) in the Payments table for each Payment record for the same invoice. So for 5 Payments records there might be InvoiceID=2 used 3 times and InvoiceID=4 used 2) . When a new record is inserted to the Payments table I need the trigger to look up all other records in that same Payments table with the same InvoiceID and update them. I tried using the Where tabs with Field=InvoiceID Equals Field=InvoiceID but the trigger doesn't work. If I manually put in a number for the 2nd InvoiceID to test it the trigger does work. So the issue is the trigger being able to match existing record's InvoiceID value with the submitted/inserted record's InvoiceID value and update them. Does anyone know how/if this can be done? It seems like it should be simple so I must be missing something basic..
  16. Dear Community, I have an issue with the Trigger Actions feature: I have one Text field, that I want to populate with the result of a query. On image_1, you can see that I'm trying to say: invoice_leader_number = "result of a query" (Just to let you know, the "invoice_leader_number" is a TEXT). Now you can see that this does not work because "2116: Only one value is expected" (cf. image_2). I've tried a work around by trying to use other functions to kind of transform the result of my query into a "one value" result, but none of the functions worked and they all expect only one value. I suppose that Caspio can't be fooled so easily So my question is: Is it possible to grab the result of a query (which is in my case just a list of Strings), concatenate them into a single string (separated with commas) and pass the concatenated result to a field? If not, what other solution does Caspio provide? Many thanks
×
×
  • Create New...