cancel
Showing results for 
Search instead for 
Did you mean: 

Update i18n label using if-else condition in cds annotations

jait23
Explorer
0 Kudos

I am using filterBar as selectionFields and Table as LineItems in my below annotation.cds.

using service1 as service from './srv/xyz-service'

annotate service.XYZ with @(UI : {
selectionFields : [
OrderType
],
....
LineItem : [
{
$Type : 'UI.DataField',
Value : Batch,
Label : {$edmJson: {
          $If: [{$Eq: [
              {$Path: 'OrderType'}, 'Discrete']},
                '{i18n>Label1}', // condition is true
                '{i18n>Label2}', // condition is false/else-block
        ]}},
}]]
}   


We have a requirement to update the label dynamically like above. Hence, using edmJson, is it possible to update it?
The above code is not giving results as expected for else block, as the view does not refresh the new i18n label based on condition.

gregorw
Active Contributor
0 Kudos

You should link this with your previous post.

jait23
Explorer
0 Kudos

Hi gregorwolf ,

Thanks for your suggestion. I have removed the former question, as it was duplicated.

Thanks,
Jait.

Accepted Solutions (0)

Answers (0)