Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Fetch a Label instead of the Value of an enumerated field

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 1

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 ]

View solution in original post

6 Replies

Avatar

Employee Advisor

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

Avatar

Employee

Hi Mahantesh,

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

Linda

Avatar

Level 2

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

Avatar

Level 2

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

Avatar

Correct answer by
Level 1

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 ]

Avatar

Level 4

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