Webhook with API_Importfromcsv Call of Variable Row Length

  • 0
  • 1
  • Question
  • Updated 1 year ago
Background:
I'm building a resource forecasting app for our office. The basic structure pertinent to this question is, there is a "Projects" table, a "Resource Allocation" table and a "Forecast" table.

I have it structured so first you would create an entry in the projects table for a given project. Then you would go to the Resource Allocation table and create a number of entries for that project, one for each resource. Project x....Joe will work 10 hours over these weeks, Jenny will work 50 over these weeks. Etc for however many resources are estimated for that project.

Now, for every Resource Allocation entry, there will be an entry in the Forecast table for every week over that project period. I.e. a variable number of records depending on the duration. I have functions in there that then take those total hours for that resource and allocate different numbers in different weeks based on some hours distribution options.



Question:
I'd ideally like to write a webhook to automatically create the variable number of forecast week records, when a resource allocation record is added. I know this would definitely be possible if it weren't for the variable length of the csv file. I tried doing it using a cascading action before I found out about the 10 calls/second limit so API_importfromcsv is my new direction.

Is there some sort of for loop or if statement syntax there I could do something like the following? (Pseudocode for conceptualization only)

<records_csv>
   <![CDATA[
      for(date, [start date], [finish date], date+7){
         [Project], [Related Resource Allocation], date
      }
   ]]>
</records_csv>

or

<records_csv>
   <![CDATA[
      if([start date]<[finish date], ([Project], [Related Resource Allocation], [start date]),"")
      if([start date]+7<[finish date], ([Project], [Related Resource Allocation], [start date]+7),"")
      if([start date]+14<[finish date], ([Project], [Related Resource Allocation], [start date]+14),"")
      if([start date]+21<[finish date], ([Project], [Related Resource Allocation], [start date]+21),"")
      if([start date]+28<[finish date], ([Project], [Related Resource Allocation], [start date]+28),"")
    ...
    ...
    ...
   ]]>
</records_csv>




I appreciate your help.
Thank you,
Leith
Photo of Leith Simpson

Leith Simpson

  • 140 Points 100 badge 2x thumb
  • Investigative

Posted 1 year ago

  • 0
  • 1

Be the first to post a reply!