Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Cstricker's Achievements


Newbie (1/14)



  1. In my case it was more a SQL syntax issue. I have been writing SQL for a long time, 20 years. Using Caspio's triggers are a very small subset of SQL obviously but I was getting caught up in their syntax. When I thought about it in terms of SQL I figured it out. The group by groups all the inserted rows, by a particular value, in this case the header id and the sum agregate sums them which is exactly how you would do it in just plain SQL. Previously I was not grouping but when I used the group by it worked.
  2. How is using Count() going to give me a SUM()? I am not really understanding your directions. I am needing the SUM of the cost of the rows in the #inserted table in a trigger. There will be multiple rows in the #Inserted table.
  3. I have attached some images and an explaination of each.
  4. 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
  5. If I was showing the data page for the updated totals table by itself I suspect it would show the new data when the datapage loads but the data page for the totals as well as the two grids of items is deployed within a web page that has 9 other data pages embedded within it so I have to reload the entire web page to see the total update when the grid items are modified. The data pages within the web page do not update automatically when the data table behind them is updated through a trigger. That is why I am looking for the ajax events to detect an update in one datapage and when the event is fired cause another data page to reload the data from the underlying table.
  6. So it seems I can use this but sporadically. The issue I have is that I am embedding 9 data pages on one web page. I should, theoretically be able to get the BeforeFormSubmit, DataPageReady, and FormSubmitted event from any of the datapages in the web page. But I seem to only be able to attach and listen to one of the datapages, and not all of them. As well, I think I need the FormSubmitted event rather than the BeforeFormSubmit. If you could guide me in the correct direction there it would be helpful. And finally related to this same topic, once I get the FormSubmitted or BeforeFormSubmitted event from one of the datapages I would like reload/refresh another database that currently displays information from a table populated by a trigger. I do not want to reload the entire web page as that takes too long. So to be more clear: I have three datapages: Page 1 - grid of pend approval costs Page 2 - second grid of approved costs Page 3 - Displays total costs from Grid 1 and Grid 2 by way of a trigger on the underlying data table from Grid 1 and Grid 2. I separate out pending approved costs from approved costs so that I can modify pending approved costs in any way, but only exclude approved costs so the grids have different abilities. I have 2 Tables - Costs (both pending approval and approved) Total of all costs When I update either Grid 1 or Grid 2 the posted data is updated in the Costs table and a trigger totals the costs (both pending approval and approved) and updates the total cost table. The datapage for total costs needs to be refreshed (through an ajax call or some event) when Grid 1 or Grid 2 is submitted. But I do not want to reload the entire page, just the embedded Total Costs datapage.
  7. I have an web page that displays 9 caspio data pages. All of the 9 data pages can be updated at any time. The caspio pages are displayed across 3 tabs on the web page. Because an update on any of the pages would trigger a reload of the web page I incorporated some java script and tables and triggers to determine which of the data pages/tables was updated last and depending on the last datapage updated the javascript would make which ever tab containing the last updated data page visible when the page was reloaded. As well there is additional javascript to completely disable all input when the data displayed is no longer available for update. Now that I can enable ajax loading which is faster than reloading the entire web page that java script feature of showing a specific tab is not needed when they update a datapage but is needed when a user initially goes to the web page. It appears the DataPage ready event still fires when doing an ajax update but I would like to know if that event fires based on an ajax update as opposed to an initial loading of the web page so I can circumvent the javascript logic which causes a small delay for the user.
  • Create New...