Hello n8n community,
As a result of reading a PDF the JSON output looks like this :
I need some help on how to target a specific text in value "Bill of Landing Number:"using the function node.
Thank you in advance.
Hello n8n community,
As a result of reading a PDF the JSON output looks like this :
I need some help on how to target a specific text in value "Bill of Landing Number:"using the function node.
Thank you in advance.
I believe the way to do this is with a Set Node, you can call the JSON element âtextâ just with {{$node[âName of the node generating the JSON outputâ].json[âtextâ]}}. The use a RegEx to find the value that follows âBill of Lading Number:â.
This would assume that the structure of your BOL is the same for each conversion , you might run into some problems if you are using BOLâs from different Carriers, for instance.
Refer to https://regex101.com/ to work out what your expression needs to look like, and there are a few useful beginner guides (Learn Regex: A Beginner's Guide - SitePoint) that have helped me build expressions with no prior knowledge.
You can then use the RegEx within your JSON expression with .match(), so it would look something like: {{$node[âName of the node generating the JSON outputâ].json[âtextâ].match(/Your RegEx/)}}
Somebody else here might be able to steer you in another direction, but this is how I would tackle the problem!
Thank you for your replay @Felix_is_stuck
Yes the file is gonna have the same structure.
But the solution did not work for me.
I believe the way to do this is with a Set Node, you can call the JSON element âtextâ just with {{$node[âName of the node generating the JSON outputâ].json[âtextâ]}}. The use a RegEx to find the value that follows âBill of Lading Number:â.
This gave me the whole content of âtextâ. While as you can see in the screenshot i need to get a specific value it.
Thatâs correct, {{$node[âName of the node generating the JSON outputâ].json[âtextâ]}} will give you the complete value. You need to add a RegEx formula to extract only the data that you want and add that formula by appending .match(formula) to your expression.
I suggest you start by reading the guide I posted above, it will help you to understand RegEx formulas.