Hi all...
i have a database-table (postgresql) with 3 columns: id (integer), year (integer) and cost_pre_hour (numeric(10,2)).
I would like to use this table as a source for a dropdown.As choicelabels I want a contaminated string in the format:
‘Price for year ’ + [year] + ‘ (’ + [cost_per_hour] + ‘)’[cost_per_hour] preferably formatted with 2 decimal places.
I just can't get it to work.
what i tried:in the record-type another calculated field:a!customFieldConcat( { "Price for ",recordType!<recordType>.fields.year," (",?????????" euro/hour)"})for ????????? i set:text(recordType!<recordType>.fields.cost_per_hour,"#.##0,00")orcast(typeof(1.0),recordType!<recordType>.fields.cost_per_hour)or other internal-cast-functions or/and combinations.I got the error Could not cast from Record Field to .... CastInvalid or something like thatWhen i try:tostring(recordType!<recordType>.fields.cost_per_hour)i see: Price for 2001 (cost_per_hour euro/hour) Realy... the name of the field instead the value.Why could appian convert a numeric(integer)-field to the correct string without problems (field: year) but with a numeric(decimal)-field i got an error or the wrong result.What is the correct/best way to set a combination of record-type-fields (incl. a formated numeric(decimal) field) as choicelabels in an dropdown?
Discussion posts and replies are publicly visible
We have encountered a similar issue in the past, and based on my understanding:Record type calculated fields cannot properly evaluate formatting functions like text() or resolve decimal field values - they return field names instead of actual values. The solution is to move the concatenation logic to your interface component where formatting functions work correctly.
As Harsha has already provided the code solution...