It's all about the answers!

Ask a question

DNG RPE How do you publish the text value of an enumeration?


Sean F (69712231) | asked Apr 16 '18, 11:39 a.m.
edited Apr 16 '18, 11:41 a.m.

When publishing enumerated attribute data from DNG using RPE the values come out as integer indexes.

Say there is an enumerated attribute Priority

It will have enumerations

0 - High
1 - Medium
2 - Low

Each enumeration value has an integer and a string value.

The 'value' extraction in the DNG Text schema using:-

dataSource/artifact/collaboration/attributes/objectType/customAttribute/value

returns the value '0' instead of the value "High"

How do you get the value 'High' ?

There is also a TS node:-
dataSource/artifact/collaboration/attributes/objectType/customAttribute/valueTS

but that does not return anything in my experimentation


Comments
Kumaraswamy Gowda commented Apr 16 '18, 11:56 a.m.

I couldn't find much information at DNG Rest API wiki.
https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI


Sean F commented Apr 16 '18, 12:40 p.m.

Thanks for having a look anyway Kumar

4 answers



permanent link
Matthew OReilly (413) | answered Apr 16 '18, 10:09 p.m.
edited Apr 16 '18, 10:10 p.m.
Hello Sean,

This is how I did it; not elegant, but it works for me. "Priority Attr" is a custom attribute

if (name  == "Priority Attr")
{
    switch (Number(value))
    {
        case 0:
                "[Essential]"
                break;
        case 1:
                "[Future]"
                break;
        case 2:
                "[Desirable]"
                break;
        case 3:
                "[Removed]"
                break;
        case 4:
                "[NA]"
                break;
        default:
                "[CHANGEME]"
                break;
                }
   
}

permanent link
vanessa lavender (11) | answered Jun 20 '18, 11:35 a.m.

 We use literal name instead of value and it prints out the text instead of the number. 


permanent link
Sean F (69712231) | answered Jun 20 '18, 1:55 p.m.
^^Thanks for the reply Matt. I was worried it was going to be something complicated like that.

^Thanks Vanessa. That looks like a nice simple solution. I will give that a try.

permanent link
Matthew OReilly (413) | answered Jun 24 '18, 8:33 p.m.
Vanessa's method works well, much neater and lower maintenance than  the Case statement.

Thanks!

PS: Note is does NOT display text in the RPE 606 preview; but then again, neither does my method. For me, it only works for a full document generation.

Your answer


Register or to post your answer.