06-18-2024 05:02 PM
How do I remove spaces from the output ?
Output of this pipeline is
[ {
"lrs": [
"Indiana",
"Alabama",
""
] }
]
Solved! Go to Solution.
06-18-2024 11:06 PM
You have two approaches, one is to continue on the path with a mapper and javascript methods, but you can use the filter method before map to only include the low risk.
$suppliersRisksResponseFromSupplierSAPI
.filter(x => x.aggregateRiskDetails.riskLevel == "Low Risk")
.map(x => x.riskDetails.supplierLocationStateCode)
The second approach is to use standard snaps to achieve the result, it may look more busy in SL designer but it is adding better readability and flexibility for the future if you want to work with other data from the input.
Attached is a sample, it will output the name of each low risk state as a separate document which you can work with or group as you wish.
06-20-2024 12:57 AM
Awesome!
Since the community does not allow upload of files with extension .slp, you can download the txt file and rename it from .txt to .slp and import it as a pipeline in snaplogic designer or manager.
06-18-2024 11:06 PM
You have two approaches, one is to continue on the path with a mapper and javascript methods, but you can use the filter method before map to only include the low risk.
$suppliersRisksResponseFromSupplierSAPI
.filter(x => x.aggregateRiskDetails.riskLevel == "Low Risk")
.map(x => x.riskDetails.supplierLocationStateCode)
The second approach is to use standard snaps to achieve the result, it may look more busy in SL designer but it is adding better readability and flexibility for the future if you want to work with other data from the input.
Attached is a sample, it will output the name of each low risk state as a separate document which you can work with or group as you wish.
06-19-2024 12:07 PM
Your first solution of using filter & then Map works perfect. Thank you.
I don't know how to use the text file you attached. Is that a Javascript file?
Anyways, I got my solution. I appreciate your help.
06-20-2024 12:57 AM
Awesome!
Since the community does not allow upload of files with extension .slp, you can download the txt file and rename it from .txt to .slp and import it as a pipeline in snaplogic designer or manager.
06-24-2024 06:32 AM
Renamed the file to .slp and ran the demo. It works perfect. Thank you.