Hello
I have a scenario with a Samcart ‘watch orders’ & ‘Get a customer’ modules that link to a Sendcloud ‘Create a Parcel’ module…The problem I am having is that the customer address is input from Samcart in a single field and the Sendcloud module wants a separate House Number variable field mapped in the module settings. I am struggling to parse the house number part out of the data bundle from the Samacart address field. I have found a regular expression that will do the job i.e. \d+[ \w]{0,2} however I dont know where or how to apply this expression on the data so that i can put it into the Sendcloud ‘House Number’ field.
I am not experienced with parsing and so any help would be gratefully appreciated
Regards
ian
Welcome to the Make community!
Here’s how to remove everything except the starting digits from a string (assuming the string starts with digits), without using a separate module for it.
{{ replace(3.shipping_address.street; "/(?<=\d+)\D.+$/"; emptystring) }}
samliew – request private consultation
Join the unofficial Make Discord server to chat with other makers!
1 Like
Thank you Samliew
That seems to work fine…I may run into issues with addresses written in a different format like some in europe that put the house number after the street name and also I am now having issues with the country field…I will need to come back to this…probably tomorrow. Thank you for your swift response…I may opt for a private consultation with you as this is quite challenging for me…
Thanks again
Regards Ian
In that case may I suggest using Google maps get a location module, you can put in the full address search and it will return you the address parts.
1 Like
Hi Samliew, I have added the google maps ‘get a location’ module as suggested and yes you are correct it can separate the address components, even the addresses with the house number at the end (Netherlands,Germany, Israel etc) as seen in the output data bundle , however, when i look at the mappable variables from this module I cannot see one for the HouseNumber as shown in the screen shots…
You help on this would be appreciated
regards ian
Hey Sam, do you also know how to get the numbers if they are at the end of the string for example? thanks!
Welcome to the Make community!
Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
A.
Save each bundle contents in your text editor as a bundle.txt
file, and upload it here into this discussion thread.
Uploading them here will look like this:
module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)
B.
If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:
-
Either add three backticks ```
before and after the code, like this:
```
input/output bundle content goes here
```
-
Or use the format code button in the editor:
Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.
This will allow others to better assist you. Thanks!
Welcome to the Make community!
That looks like a new question, could you please create a separate topic for this?
While it’s tempting to continue an existing thread, a more effective approach would be to start a new topic. It helps other community users to respond to your query, and keeps our space organised for everyone. If you start a new conversation you are also more likely to get help from other users. You can refer others back to a related topic by including that link in your question. Thank you for understanding and keeping our community neat and tidy.
The “New Topic” link can be found in the top-right of the header:
1 Like
Hi Samliew
Please find attached to this reply all the data you asked for…as you will see the output using your regular expression works fine for house numbers at the beginning of the 'street address" string it produces an error when the house number is at the end of the string as the example in op3…As you correctly stated the Google maps module can extract the house numbers regardless of where they are in the address string…however as i said in my last response i cannot see a mappable variable from the google maps module…
SamcartWATCHORDERS_Output_bundle.txt (10.0 KB)
SamcartGETACUSTOMER_Input_bundle_OP1.txt (42 Bytes)
SamcartGETACUSTOMER_Output_BundleOP1.txt (669 Bytes)
GooglemapsGETALOCATION_input_bundle_op1.txt (125 Bytes)
GooglemapsGETALOCATION_output_bundle_op1.txt (2.7 KB)
GooglemapsGETALOCATION_input_bundle_op3.txt (100 Bytes)
GooglemapsGETALOCATION_output_bundle_op3.txt (2.1 KB)
SendcloudCREATEAPARCEL_input_bundle_op1.txt (398 Bytes)
SendcloudCREATEAPARCEL_output_bundle_op1.txt (2.0 KB)
SendcloudCREATEAPARCEL_input_bundle_op3.txt (393 Bytes)
I look forward to your response
regards ian
Use the address components
2 Likes
Hi Samliew…thank you for your response…i tried the variable ‘address components’ but didnt realise i had to add the array variable…by adding this i have moved forward with my integration.
thank you again for your patience with me…you have been a great help…my next challenge will be extracing the required ‘states’ and regions for certain countries but your responses have pointed me in the right direction …the google module should help with my challenges.
3 Likes