Home > Forum > Rules, JS, SQL > List of items - two different values in one column of a table

List of items - two different values in one column of a table
0

Hello Community,
I've got a problem. I've got two workflows, a parent and one subworkflow. I'm trying to transfer data from the parent workflow (single line of text attributes - 'email' and 'phone') to a table in the subworkflow with the item list update action. The table has columns ('value' - single line of text and 'contact type'(selection list: 1#Mail, 2#Phone)). How to write an SQL query to put different WFD_AttText attributes into one DET_Att column and different Att_Choose values into one DET_Value column into the 'value' column, so that the 'email' and 'phone' attributes get good contact types.

MVP

Hi Sandra,

I read your question a few times, but I'm still not sure that I got it.

What I understood is the parent instance has:
Phone: +49 1347 541687
Mail: someone@example.com
and other fields

You want to populate an item list in a sub workflow with this data like this
Contact type | Value
_________________
Mail | someone@example.com
Phone | +491347

This makes more sense after you have looked at the picture.
select '1#Mail' as ContactType, {WFCONCOL:1798} as Value from WFElements where WFD_ID = PARENTWORKFLOWID
union
select '2#Phone' as ContactType, {WFCONCOL:1797} as Value from WFElements where WFD_ID = PARENTWORKFLOWID

@Martin
I have to look into this UNPIVOT function as I have no real idea what it does. :)

Best regards,
Daniel

Privacy overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.


To see a full list of the cookies we use and learn more about their purposes, visit our Privacy Policy.