[SOLVED] LazReport and using scripts lazarus / 16-Databases ---------------------------------------------------------------------- madref · 2015-07-01 17:55 I am using the following script-code to determine if a distance is further than 150 km or not. This works fine, but the outcome is a currency (euro's). Code: [Select]if [TQ_Rapport."IJS_Kilometers"]>=150 then Text := [TQ_Rapport."IJS_Parkeren"]+ 7,5 else Text := [TQ_Rapport."IJS_Parkeren"]; I would like to format this so that it has 2 decimals (8,50 instead of 8,5). In LazReport you can format a field, but this DOES NOT work for scripted fields. Is there another solution? ---------------------------------------------------------------------- paweld · 2015-07-01 20:39 Code: [Select]if [TQ_Rapport."IJS_Kilometers"]>=150 then Text := FormatFloat('0.00', [TQ_Rapport."IJS_Parkeren"]+ 7,5) else Text := FormatFloat('0.00', [TQ_Rapport."IJS_Parkeren"]); ---------------------------------------------------------------------- madref · 2015-07-02 03:33 Sorry but does not work in a script ---------------------------------------------------------------------- jesusr · 2015-07-02 13:26 What you mean with "does not work in a script"? does it show something do you expect?, it doesn't show anything?. FormatFloat is supported My guess is that it doesn't show anything because Code: [Select]Text := FormatFloat('0.00', [TQ_Rapport."IJS_Parkeren"]+ 7,5) + 7,5 looks suspicious to me, most probably the interpreter sees this like a syntax error.  Try with 7.5. Also most scripts would be need to be wrapped between "begin" and "end" ---------------------------------------------------------------------- madref · 2015-07-02 20:00 i thought that it wouldn't work but i made a typo. i had a space between FormatFloat and ('0.00',..... When i did it without the space it worked like a charm.