cancel
Showing results for 
Search instead for 
Did you mean: 

Value to Field Mapping

Henchway
Contributor

Hi everyone,

I’ve been trying to find a function that would allow a “Value to field” mapping such as this:

image

As depicted, i would like to use Values as Keys in order to use them in expression libraries for value mapping tables.

I’ve been trying several functions, but my knowledge of Json & Javascript is rather limited, just starting out with Snaplogic and haven’t had any trainings either i’m afraid.

I’d appreciate any help!

Thanks and best regards
Thomas

1 ACCEPTED SOLUTION

dimitri_hristov
Contributor

Hi @Henchway,
In this post, I have attached a pipeline that can demonstrate my solution to your question.
In the first JSON Generator Snap I generate the test data according to your problem statement.
Then I use a Group By N Snap to generate input for the final snap in a usable format.
Lastly, in the final snap, a JSON Generator, I use Apache Velocity to output the data in the desired format.
Please have a look at the pipeline, and I’ll be happy to answer any further questions you may have.
BR,
Dimitri

ValueToFieldMapping_2020_03_23.slp (4.5 KB)

View solution in original post

3 REPLIES 3

dimitri_hristov
Contributor

Hi @Henchway,
In this post, I have attached a pipeline that can demonstrate my solution to your question.
In the first JSON Generator Snap I generate the test data according to your problem statement.
Then I use a Group By N Snap to generate input for the final snap in a usable format.
Lastly, in the final snap, a JSON Generator, I use Apache Velocity to output the data in the desired format.
Please have a look at the pipeline, and I’ll be happy to answer any further questions you may have.
BR,
Dimitri

ValueToFieldMapping_2020_03_23.slp (4.5 KB)

Thank you very much! This is exactly what I’ve been looking for.

Best regards
Thomas

Perfect! I like your solution.