ContributionsMost RecentMost LikesSolutionsRe: API Button to Edit Multiple Child Records at the same time Thanks Mark. I figured a pipeline was what I would end up having to do, but was trying to be slick with a button that would update the records instantly. I am curious how much your consulting fee is per hour. I will email you separately about that. ------------------------------ Matt S ------------------------------ Re: API Button to Edit Multiple Child Records at the same time Correct, the button is on the parent table and would be on the parent record form. When clicked it would update a few different fields on all the child records associated with that parent. Hope I explained that better. ------------------------------ Matt S ------------------------------ API Button to Edit Multiple Child Records at the same time Hello, I'm very new to API Buttons and could use a little bit of help. I'm trying to create a button on the parent table that, when pressed, will update specific fields in the associated child records and then return to the original parent record form. Basically when clicked General Table Information: I have two tables I'm working with here. The Parent table is [LOCATIONS] and the Child table is [VEG___FLOWER_PLANTS]. So basically, a [LOCATION] has many [VEG___FLOWER_PLANTS]. I've tried this a few ways and I keep getting an error. Here is what I have in my Formula URL: //edit the Child Record var text URLONE = URLRoot() & "db/" & [_DBID_VEG___FLOWER_PLANTS] & "?act=API_EditRecord"& "&rid=" & [Record ID#] & "&_fid_20=" & URLEncode([Abbreviation]) & "&_fid_23=" & URLEncode("Flowering") & "&_fid_9=" & URLEncode(Today()) & "&apptoken=b8bt467bv36g6icr3fmfgcwf4c42"; //return to original record and form (opens original record in view form ) var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]; $URLONE & "&rdr=" & URLEncode($URLTWO) I've also tried this way and continue to receive errors: //edit the Child Record var text URLONE = URLRoot() & "db/" & Dbid & "?act=API_EditRecord"& "&rid=" & [Record ID#] & "&_fid_20=" & URLEncode([Abbreviation]) & "&_fid_23=" & URLEncode("Flowering") & "&_fid_9=" & URLEncode(Today()) & "&apptoken=b8bt467bv36g6icr3fmfgcwf4c42"; //return to original record and form (opens original record in view form) var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]; $URLONE & "&rdr=" & URLEncode($URLTWO) It might be worth noting that fid=20 in the child table is the [Related Location] (parent). So basically I'm trying to change the [related Location] from what it currently is to its abbreviation (which is technically the next location the plants move to). Am I close or am I completely off base with the way I'm going about this? Any help is appreciated. EDIT: I should probably also note that I do not have Application Tokens turned off, so that is why I have an app token listed at the end of var text URLONE. I'm not sure if this is needed or if I've done it correctly. ------------------------------ Matt S ------------------------------ Re: Add Multiple Child Records at one time to a join table and have the records linked to both parent tables You're right, I don't need both. My understanding is that you can only do one or the other. I posted both ways of doing it in case some beginner like me has a similar issue/question and stumbles upon this post in the future. Thank again for your time and help! ------------------------------ Matt S ------------------------------ Re: Add Multiple Child Records at one time to a join table and have the records linked to both parent tables Looks like I figured it out!! Either one of the following seems to work (they are the same thing just written as a normal query and as an advanced). Seems I had my logic turned around. If you think there is a better and/or more optimized way to do this I'm all ears, but this seems to work. @Mark Thanks for your help/input. Greatly Appreciated! Your solutions on other threads have been very valuable to me as well! ------------------------------ Matt S ------------------------------ Re: Add Multiple Child Records at one time to a join table and have the records linked to both parent tables UPDATE: I van now create multiple records using the bulk upsert method, however the search query doesn't seem to be working correctly because the [Related Plant Tags] that get added to the join are 1) not the correct tags and 2) the number of records created not correct. In the screenshot below you can see that my [Starting Tag] is 178605 and and my [Ending Tag] = 178610. This should a total of 6 records (tags 178605 through 178606). However, 7 records are created and the tag numbers are not correct. Also, to get this to work I had to use the "OR" operator instead of "AND". If I use "AND" no records are created. If I use OR I get the issue described above. It is probably also pertinent to note that when I try other tag numbers the number of records created are all over the place. Sometimes 25 records are created, sometimes 41, and other times 7 (as seen in the screenshot). I'm sure I'm missing something basic here but can't for the life of me figure it out. ------------------------------ Matt S ------------------------------ Re: Add Multiple Child Records at one time to a join table and have the records linked to both parent tables I seem to have stopped stopped the endless looping but am still stuck. As requested, I've attached a couple of screenshots of the advanced queries I've tried. They produce little to no results. If I use an advanced query that utilizes the 'EX' function I can get one record to create with the [starting_tag] like I want to but I can't get more than one record created. If I have one condition set in a normal query I can get one record to be created. The only multiple conditions that work are in the image below but because the conditions are start with and end with, I only create the starting tag and he ending tag. I just cant seem to get the conditions right to run from the starting tag to the ending tag and create records for the starting tag, ending tag, and all tags in-between the two. ------------------------------ Matt S ------------------------------ Re: Add Multiple Child Records at one time to a join table and have the records linked to both parent tables @MarkShnier I'm trying both methods but the problem I'm having is the search for the tags. I obviously don't have the conditions set properly because the loop just keeps running. Should I be using an advanced query of some sort? ------------------------------ Matt S ------------------------------ Re: Add Multiple Child Records at one time to a join table and have the records linked to both parent tablesRe: Add Multiple Child Records at one time to a join table and have the records linked to both parent tables Thanks Mark. I thought it was something like that, but I've been having trouble with the start and end tag search working properly. I will dig into it more and see if I can get it to work. Glad to know I'm on the right track at least. ------------------------------ Matt S ------------------------------