Fetch a Label instead of the Value of an enumerated field | Community
Skip to main content
Level 2
March 21, 2017
Solved

Fetch a Label instead of the Value of an enumerated field

  • March 21, 2017
  • 6 replies
  • 7437 views

Hi,

Suppose, I have a schema field based on an enumerated type

Enumerated datatype

  <enumeration basetype="byte" default="sms" label="Mobile message type" name="mobileMsgType">

    <value label="SMS" name="sms" value="0"/>

    <value label="WAP Push" name="wapPush" value="1"/>

    <value label="MMS" name="mms" value="2"/>

  </enumeration>

Column in the schema is defined of the type enumerated

      <attribute enum="mobileMsgType" label="Message type" name="mobileMsgType" type="byte"/>

When I use the querydef on such a column, it will return the value as "0" or "1" or "2". Instead, I want to fetch their labels like "SMS" or "WAP Push" or "MMS", could you please advise.

Regards,

Mahantesh

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by wizDart_com

Mahantesh,

You can easily accomplish this using  analyze=”true” parameter.

Basically in a querydef, you need to have the parameter: analyze=”true”.

For a field named @state, it will create attributes @stateLabel and @stateImg.

Then you can use that for your label values. Feel free to unicast me for a sample.

Arvind Jain [ cmu2010@gmail.com ]

6 replies

vraghav
Adobe Employee
Adobe Employee
March 23, 2017

Hi Mahantesh,

queryDef is used to fetch data from database. Enum however, is not present inside database, it is part of the schema definition and hence it will not be straightforward to export the enum label.

You will have to somehow read the schema definition, extract enum definition and compare it against your queryDef value to export enum label.

Hope this helps.

Regards,

Vipul

Linda_Stinson
Adobe Employee
Adobe Employee
March 24, 2017

Hi Mahantesh,

What do you want to do with the labels? You could make the substitution in your JavaScript.

Linda

MeMontyAuthor
Level 2
March 27, 2017

Hi Vipul,

Thanks for your response.

I am planning to export the data ... campaigns > deliveries > delivery logs & tracking logs  ... for all the campaigns into an external EDW database to analyse the effectiveness of each of the campaign/delivery.

If I use the Export (use Labels) through series of query/enrichment activities, I can get the labels. But since I need an email subject as well in the export, I am switching from enrichment to Javascript to create a staging table with limited columns (parallel to delivery) containing the delivery data with email subject. In the javascript I would like to have the labels instead of actual values to push into the staging table.

Regards,

Mahantesh

MeMontyAuthor
Level 2
March 27, 2017

Hi Linda,

Thanks for your response.

I have explained in a reply to Vipul ... what I want to do.

As per you, are you suggesting to hard coded the lables in Javascript?

Regards,

Mahantesh

wizDart_com
wizDart_comAccepted solution
Level 2
February 26, 2018

Mahantesh,

You can easily accomplish this using  analyze=”true” parameter.

Basically in a querydef, you need to have the parameter: analyze=”true”.

For a field named @state, it will create attributes @stateLabel and @stateImg.

Then you can use that for your label values. Feel free to unicast me for a sample.

Arvind Jain [ cmu2010@gmail.com ]

tejashriw155148
Level 4
November 21, 2019

could you please help to fetch enum label instead of values which has been created in schema?