Forum Discussion
KristofferKeen1
4 years agoQuickbase Staff
You can use the Text channel to "Find All Matches to a Regex", and use the following Regex: ([^;]+) if you go with the multi-select option which separates values using a semi-colon. Otherwise, you can change the semi-colon to a comma in the middle of the regular expression, since the comma is the delimiter in your use case: ([^,]+)
Then For each "match/Regex filtered group" (because it's split by a semi-colon or a comma in your case), you can then use each group to create a new record.
So in the subsequent create record step, map the regex step's Group 1 to the new table: {{b.group_1}}
See screenshots below for reference.
Enjoy!
------------------------------
Kristoffer Keene
------------------------------
Then For each "match/Regex filtered group" (because it's split by a semi-colon or a comma in your case), you can then use each group to create a new record.
So in the subsequent create record step, map the regex step's Group 1 to the new table: {{b.group_1}}
See screenshots below for reference.
Enjoy!
------------------------------
Kristoffer Keene
------------------------------
- JennasonQuick_B4 years agoQrew TraineeKristoffer- Many thanks for your reply. A follow up question to see if I am understanding this method correctly:
Does this method require there be the same # of items in the list of values everytime? In my situation I will have records where the multi-value field has different #s of values (E.g. record 1 might have 1 value in that field, record 2 might have 2 values in that field, etc). So in each case I need to make sure the loop in pipelines can be dynamic based on the # of values in that field.
I think what was throwing me off is the 'Group_1' notation and I'm just not familiar with the Regex step. Does the regex step provide this 'dynamic' capability? Or does 'Group_1' mean the first value in the group? and subsequently there would be a 'Group_2', etc if the field had multiple values? which would seem to imply it doesnt provide that dynamic capability.
Apologies if I am not following correctly. Thanks.
------------------------------
Jennason Quick Base Admin
------------------------------- KristofferKeen14 years agoQuickbase StaffYou are correct that regex group will be dynamic, meaning if there are 3 values split by a comma (value1, value2, value3) then three records will be created. If the next time there are 5 (value1, value2, value3, value4, value5) then five records will be created. Group means for each match found in the regular expression (in your case a new group for every comma)
------------------------------
Kristoffer Keene
------------------------------
- PaulPeterson13 years agoQrew Assistant Captain@Kristoffer Keene, I need to do something nearly identical, how could this be modified to iterate through each and search another table to create a bulk upsert?
------------------------------
Paul Peterson
------------------------------- KristofferKeen13 years agoQuickbase StaffHey Paul, I hope the screenshot below helps direct you better:
You could prepare the upsert as step b and have one final import/upsert at the very end of all records found, but in the example above, I showed how to prepare and upsert per split.
I think your biggest question is around getting the search step to match the split field, so here's another screenshot setting the search query to match the Regex's group 1 response:
Let me know if you have any additional questions :)
------------------------------
Kristoffer Keene
------------------------------- PaulPeterson13 years agoQrew Assistant Captain
Thank you! This is creating the results I need. It's painfully slow and that is a concern since this was run in a test instance of the app with about 10% of the data in the production app. Fortunately, I have a meeting with an SA soon and will use this as the starting point and will share their suggestions.
Thanks again for your help!!
------------------------------
Paul Peterson
------------------------------
- BrittanyScheid2 years agoQrew CadetHi Kristoffer,
I'm brand new to regex but I'm trying to loop through the users in a List-User field to then create a child record for each. I used the expression and process you indicated above, but it seems to only be returning the first user, not any of the others. I wasn't sure what all the other fields should be set to in the Query step, so I just left them as the defaults. Any help would be greatly appreciated! Thanks!
------------------------------
Brittany Scheid
------------------------------- KristofferKeen12 years agoQuickbase StaffHey Brittany-
Looking at your screenshot, the jinja looks correct. So I want to double check:
- that you grabbed the correct list-user field?
- there is more than 1 user listed in that field for the record you found
- do you have the for each loop after this step?
------------------------------
Kristoffer Keene
------------------------------- BrittanyScheid2 years agoQrew CadetHi Kristoffer,
Thanks for your response. See my answers to your questions below:
- that you grabbed the correct list-user field? Yes
- there is more than 1 user listed in that field for the record you found. Yes, I've tried multiple various selections and triggered the pipeline several times.
- do you have the for each loop after this step? Yes. See the attached screenshots.
------------------------------
Brittany Scheid
------------------------------
- BrianSeymour10 months agoQrew Cadet
@Kristoffer Keene solid tip to Find All Matches to a Regex via the Text channel to parse and loop through the multi-select semi-colon delimited values! I like that approach.
Thank you :)
------------------------------
Brian Seymour
------------------------------