Forum Discussion
- StephenStephenQrew Assistant CaptainThe key field is not Record ID, it is [SOP+SKU] Field.
The record being updated is fid 127 in the destination table using the value in the [Order Status] field from the source table.
All this works correctly but for only 1 record at a time. I would have though it would fire on all changes? - MichaelGraham2Qrew Assistant CaptainI think for this you can use the %RepeatOn% and %RepeatOff% so that it picks up all the records.
- MichaelGraham2Qrew Assistant CaptainYou may also have to use API_ImportFromCSV.
Use API_ImportFromCSV to add or update several records. You invoke this call on a table-level dbid. You can add AND update in the same API_ImportFromCSV request. (For an Add, leave the Record ID empty.) - StephenStephenQrew Assistant CaptainI tried repeat but must have implemented wrong. I'll switch to API_ImportFromCSV and give that a try. Thanks.
- MichaelGraham2Qrew Assistant CaptainJust another quick one. I don't think you need the Key Field / Record ID in the header as for me that would just indicate a single record. Just thinking :)
Have a look in the API.- StephenStephenQrew Assistant CaptainMichael, I guess that is perhaps where I'm goofing up (Forgive me I'm new to this.)1. If I don't put the Key in there, how does the webhook know which record in the parent table to update?
2. Shouldn't the webhook fire one time for each record in the source table, rather than 1 time for 1 record and not for the rest?
3. The "repeat" had made sense to me in the case it only fires once, but I wasn't sure how to implement that. I tried it but it did not work (probably because I did it wrong)
4. Is there written documentation somewhere that shows how to do this stuff? I have looked at the PDF API guide, but it talks NOTHIGN about %RepeatOn% and other syntax issues. Perhaps I should be modeling this knowledge on some general language rules outside Quickbase, but I don't know where to look. I can learn it if I can just find the knowledge resource.
Thanks! - StephenStephenQrew Assistant CaptainI suspected that if I didn't the Key field in there it would ADD a record when I just want it to update existing?
- MichaelGraham2Qrew Assistant CaptainIn one of the webinars Kirk Trachy discusses webhooks around the 50 minute mark.
You can view it here. https://quickbase.webex.com/quickbase/onstage/g.php?RCID=0f84c132c8ee5cedca1ce94338ae3a7a
Just click on playback and enter your email etc to view it.
- StephenStephenQrew Assistant CaptainMichael, That webcast was so helpful. It showed me I was doing it all wrong and went this route and it worked the first time!
the Key is this: The "repeat" is put around the the top section only because the API is building a CSV table to hold the read data. Then the <clist> section merely writes all the data at once. That was confusing until the host explained that.
Secondly, when the record ID is the one of the fields in the destination clist, it updates and if the record ID isn't there it adds. Very nice!
<qdbapi>
<usertoken>bxxxxxxxxxxxxxx</usertoken>
<records_csv>
<![CDATA[
%RepeatOn%
[new.SOP+SKU.csv],[new.Order Status.csv] <=== FIELDS you want the data from
%Repeatoff%
]]></records_csv>
<clist>6.7</clist> <=== FIELDS DATA IS GOING TO IN THE TABLE ABOVE (LINK)
</qdbapi>