[Lazarus] LazReport - Build variable or field names in script

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] LazReport - Build variable or field names in script

Free Pascal - Lazarus mailing list
Hi All,

I can build variable

TEXT := '[PAGE_LNG_' + [LNG_ID] + ']: [PAGE#]';

and field

TEXT := '[BDS.PAGE_LNG_' + [LNG_ID] + ']: [PAGE#]';

names in this way.

LNG_ID is a report variable with a numeric value and the showed captions
or used field names depends on it. I try to eliminate the if then else
if then else if then else ... chains which give back the result depend
on the language.

Is this the good/safe solution? Any simpler/better exists?

Gabor
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] LazReport - Build variable or field names in script

Free Pascal - Lazarus mailing list
En Tue, 15 May 2018 10:58:57 -0500, Gabor Boros via Lazarus  
<[hidden email]> escribió:

> Hi All,
>
> I can build variable
>
> TEXT := '[PAGE_LNG_' + [LNG_ID] + ']: [PAGE#]';
>
> and field
>
> TEXT := '[BDS.PAGE_LNG_' + [LNG_ID] + ']: [PAGE#]';
>
> names in this way.
>
> LNG_ID is a report variable with a numeric value and the showed captions  
> or used field names depends on it. I try to eliminate the if then else  
> if then else if then else ... chains which give back the result depend  
> on the language.
>
> Is this the good/safe solution? Any simpler/better exists?
>
> Gabor

As CASE OF is not implemented, that's the way of doing it. By using the  
OnGetValue event you might get more control on selecting the right values  
based on the LNG_ID, or even using a user defined function could work also.

Jesus Reyes A.
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus