Hello!
Is it possible to define which value to use from when there is more than one value?
I’d like to extract the ‘0’ and ‘1’ value seperately.
Somehing like {{...__line_items.]propertiessProperty 1 here]value}}.
Hello!
Is it possible to define which value to use from when there is more than one value?
I’d like to extract the ‘0’ and ‘1’ value seperately.
Somehing like {{...__line_items.]propertiessProperty 1 here]value}}.
Hi
Could you explain your challenge a bit more detailed? Maybe with some example? This way we can understand it better.
I am not sure if I understand your question, but maybe you can use an action “Formatter by Zapier” to format the output in some sort of input you want to have.
Let me know!
~Bjorn
Hi Bjorn
Thank you for taking your time to understand my issue.
I am trying to extract some data from Shopify. Problem is that it combines two sets of data into one.
So when I add the line item I get both the value of properties 0 and 1 combined. I can however split the text and get the URLs extracted. But I have no clue how to extract the value from properties 1 only. I thought there were some way I could define zapier to only read line item - properties - 1 - value.
This is the data I get in from Shopify:
line_items
0:
properties
0:
name: Link til bolig
value: https://www.realmaeglerne.dk/bolig/4911278-brunebjerg-17
1
name: Vælg indhold
value: 1. Kort, 3. Kontakt- & boliginfo
1:
properties
0:
name: Link til bolig
value: https://www.realmaeglerne.dk/bolig/529-1306-koldinghuse-nord-2
1:
name: Vælg indhold
value: 1. Kort
This is the data I get out:
Line 1: “https://www.realmaeglerne.dk/bolig/4911278-brunebjerg-17,1. Kort, 3. Kontakt- & boliginfo”
Line 2: “https://www.realmaeglerne.dk/bolig/529-1306-koldinghuse-nord-2,1. Kort”
This Is how I would like it
(Properties 0 value)
Line 1: “https://www.realmaeglerne.dk/bolig/4911278-brunebjerg-17”
Line 2 “https://www.realmaeglerne.dk/bolig/529-1306-koldinghuse-nord-2”
(Properties 1 value)
Line 1: “Kort, 3. Kontakt- & boliginfo”
Line 2: “1. Kort”
Hope it made sense even though I’m pretty new to zapier.
Thanks for the explanation
The challenge you have here is a bit difficult. You are getting the values of your properties in different objects (0 and 1) and from both objects you want to retrieve a value again with the same key.
This will probably require some code which I can’t provide to you on the spot. I will try out some stuff, but in the meantime let’s see if
Let me know if you figured out something yourself.
~Bjorn
Please write if any proposals for Zapier comes to your mind. Because I’m out of ideas.
Hi
Ok, let me try to solve this problem. In a Code step with the following code snippet, add a new input field called raw
and its value should be in this format {{86783928__line_items}}
where 86783928 is the previous step ID and line_items is where the line items are stored.
const lineItems = m];
const lines = inputData.raw
.replace(/\n{2,}/g, "\n")
.replace(/^properties: /gm, "")
.replace(/'/g, '"')
.split("\n")
.map(JSON.parse)
.map((line) => line.map((it) => it.value))
.forEach((line) => {
line.forEach((item, i) => {
lineItemsIi] = lineItemsIi] || ]];
lineItemsIi].push(item);
});
});
output = u{ lineItems }];
The output should look like this:
I hope this helps.
Thank you so much
I’m getting this error: Traceback (most recent call last): SyntaxError: invalid syntax (<string>, line 8).
And to be honest I have no clue what I’m doing. I can see that you offer a service helping out with these things, so maybe you could invoice me and help me in the specific zap?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.