How to count number of records based on values in fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 01:19 PM
I have a table containing two fields, Field A stores the name of the organization and Field B stores a corresponding value. An organization (in Field A) can have many records, each with potentially different values and there are many organizations. What is the best way to query that table, count the number of occurrences where the values are within a certain range for each of the organizations, and insert them into a second table (one record for each organization)? Also, is that via a Business Rule script? Sorry, this may be an easy one but I am relatively new to SN.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 01:28 PM
Yes, you can do this via business rule. But when do you want to insert the records into the second table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 01:54 PM
First table is imported via transform map and then records get automatically inserted based on business rules as described on my previous note. Is there a good script example that I can reference?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 01:58 PM
Can you provide a bit more info. For example Comp A has 2 values in table A and an associated record in table B is created. Now 3rd value is newly imported into the table A, now do you want to update the record in table B or create anew one?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 02:12 PM
For example, Comp A has four values (10, 20, 50, 60) in Table A. All that data is imported. Meanwhile, there is already an empty Table B in place. Upon import, I would like for the Business Rule to query Table A and insert a row into Table B which populates Comp A into one of the columns and the number of occurrences where Comp A has values greater than 30 into the other column, which in this example would be '2'. The same would be repeated for Comp B, Comp C, etc...and Table A is not necessarily sorted by company name.