draganr
I'm new here

Expression inside FS_DATASET (radiobutton value)

Jump to solution

Hi all,

I need help with the expression inside FS_DATASET.

DATABASE:

219147_pastedImage_5.png

TABLE TEMPLATE FIELD:

  <CMS_INPUT_RADIOBUTTON name="tt_color" gridHeight="1" gridWidth="2" hFill="yes" preset="copy" useLanguages="no">

    <ENTRIES>

      <ENTRY value="white">

        <LANGINFOS>

          <LANGINFO lang="*" label="White"/>

        </LANGINFOS>

      </ENTRY>

      <ENTRY value="orange">

        <LANGINFOS>

          <LANGINFO lang="*" label="Orange"/>

        </LANGINFOS>

      </ENTRY>

    </ENTRIES>

    <LANGINFOS>

      <LANGINFO lang="*" label="Color"/>

    </LANGINFOS>

  </CMS_INPUT_RADIOBUTTON>

FS_DATASET:

<FS_DATASET

    name="st_icon"

    allowDelete="no"

    allowEdit="no"

    allowNew="no"

    hFill="yes"

    mode="combobox"

    selectorMode="list"

    useLanguages="no">

    <LANGINFOS>

      <LANGINFO lang="*" label="Icon (optional)" expression="#item.Label + &quot;&quot;"/>

    </LANGINFOS>

    <SOURCES>

      <CONTENT name="icons"/>

    </SOURCES>

  </FS_DATASET>

I need that field value: IconColor

219148_pastedImage_8.png

i have tried with #item.IconColor.toString, but no results.

Any ideas?

Best regards,

Dragan

0 Kudos
1 Solution

Accepted Solutions

Hello Dragan,

you've set your IconColor as XML, not as String. That's why #item.IconColor is not working.

Is it a new field? If yes, you should set it to String. If not there's an expression that should work but I highly recommend to migrate the field instead of using the expression:

#item.getValue(&quot;IconColor&quot;).getData().getElementsByTagName(&quot;VALUE&quot;).item(0).getTextContent()

This snippet gets the Value-Node from the XML representation.

Best regards

Felix

View solution in original post

0 Kudos
6 Replies
felix_reinhold
Returning Responder

Hello Dragan,

for me using #item.IconColor works. Is the field defined as a String in the scheme?

If you're not sure which datatype you get just use #item.IconColor.getClass().toString() to see if you get a String or sth. like an OptionValue.

Then you would have to use .getValue() on it.

My Expression in my testcase looks like this:

<LANGINFO lang="*" label="Icon (optional)" expression="#item.Label + &quot;-&quot; + #item.IconColor"/>

Best regards

Felix

0 Kudos

Hello Felix,

I've tried with #item.IconColor , but then I get only IDs, so it's broken:

219252_pastedImage_0.png

With #item.IconColor.getClass().toString() i get the same result.

And, also, the same with .getValue().

This is my schema:

219251_pastedImage_6.png

Kind regards,
Dragan

0 Kudos

Hello Dragan,

you've set your IconColor as XML, not as String. That's why #item.IconColor is not working.

Is it a new field? If yes, you should set it to String. If not there's an expression that should work but I highly recommend to migrate the field instead of using the expression:

#item.getValue(&quot;IconColor&quot;).getData().getElementsByTagName(&quot;VALUE&quot;).item(0).getTextContent()

This snippet gets the Value-Node from the XML representation.

Best regards

Felix

0 Kudos

Hi Felix,

Thank's for the advice, and your help.
I'm aware of using the string as a better choice, but we needed a radiobutton there.

Best regards,
Dragan

0 Kudos

Hi Dragan,

You can use the radio button with the field type String - that's what I meant Smiley Happy

Best regards

Felix

0 Kudos

Hi Felix,

Ah, I tried that once, and I got an error, so I thought it was not possible.

Thank you so much for your help.

Best regards,
Dragan

0 Kudos