Label with pipe formatting breaks page in tool (works when running)

Adding text to a label with pipeformatting breaks the rendering of a page in the radzen tool. When running the app and browsing to it, that page works perfectly.

Example:

{
"name": "label13",
"text": "${calculatedFields?.openCredit | currency:'EUR':'symbol':'1.2-2'}",
"type": "label"
}

Hi Ruben,

Can you post a screenshot how it looks on your end?

Best Regards,
Vladimir

Sure.
I get an empty page...

When I remove all the labels:

When I run the app with the formatted labels in place:

Thanks. We reproduced the problem. It is a long standing issue where Radzen tries to generate sample data suitable for any expression. When Radzen fails for some reason to infer the type of an expression e.g. foo.bar.baz it tries to guess it. In this case however the guess is incorrect - the sample data created for calculatedFields.openCredit ends up being string instead of a number. Maybe this strategy is flawed from the beginning and Radzen shouldn’t be that ‘smart’.

What if the label displayed in design time the expression itself (calculatedFields?.openCredit | currency:‘EUR’:‘symbol’:‘1.2-2’) or some hardcoded value e.g. [data-bound]? Right now it tries to guess that openCredit is a number and fails hence the problem.

What do you think?

The problem here seems to be that radzen can not handle the pipe.
Is it possible to detect te pipe and in design time show [Expression] on the label? Or your [data-bound] suggestion for all labels that use an expression (with or without pipe) to have some consistency.

Yes, we can definitely do that. We will try to fix that soon.

The latest Radzen version should no longer break in such cases. The Value of the label will still be invisible though. Radzen will display [Expression] only if Angular fails to evaluate the expression in design time. In the calculatedFields?.openCredit | currency:‘EUR’:‘symbol’:‘1.2-2’ case Angular now successfully evaluates the expression in design time to empty string.

Hi ,
I'm doing the following in the datagrid column template.

${data?.checkvalue!=0?-1*(data?.total/100)*data?.percentage | currency:'EUR':'symbol':'1.2-2' : 0 | currency:'EUR':'symbol':'1.2-2' }

This breaks compilation.
I'm comparing a value in the row and return calculated percentage of total or return 0 and want this be formatted as a currency with tow decimal digits.

b.r.
Mehmet

This is not a valid Angular expression. Pipes should be used only once - used parenthesis to get the value and then apply the pipe. ${(data.checkvalue != 0 ? data.total / 100 : 0) | currency }

Hi ,
this applies only for the false value : if result is false it will render to "€ 0.00" and if the result is true just the value without the Euro sign and number formatting.

Do I miss something ?
image

Can't really tell as I don't see the complete code. Can you paste it here?

${(data.x_afwijsreden != 0 ? -1*data.totaalBedrag/100*data.diersoortSchade : 0) | currency:'EUR':'symbol':'2.2-2' }

It seems that Radzen doesn't generate the correct Angular expression in this case. Please try the following while we try to find a solution:

{{ (data.x_afwijsreden != 0 ? -1*data.totaalBedrag/100*data.diersoortSchade : 0) | currency:'EUR':'symbol':'2.2-2' }}

1 Like