Jordi.Tolra
4th April 2008, 13:00
Hola a tothom,

does anybody know if it is possible change dynamically the attributes of one field from the report script. For instance: there is a field which sometimes should be printed normal and sometimes should be printed in Bold, depending on a condition.

Thanks & regards

Jordi

george7a
4th April 2008, 13:26
Hi,

You can make 2 layouts, one includes the bold field and the other one includes the normal field. Then from the code you can decide which layout to print.

I hope it helps,

- George

Jordi.Tolra
4th April 2008, 13:31
Thanks George,

I already thought in this solution, but my problem is that I use the option layout.again and I print the layout several times. That's why I can't have two layouts.

Thanks again

Jordi

george7a
4th April 2008, 13:40
Hi,

Another idea is to put two fields in the same layout, one bold, and the other one normal. In the script you can choose to hide the field you want.

- George

mark_h
4th April 2008, 15:21
Or one field in the same layout then use the report script to determine if the field is bold or not. So the field would be a string field and contain the escape sequence for bold and the variable.

Hitesh Shah
4th April 2008, 15:46
If the conditional expression is less than 60 chars then u can write an expression like this in the report layout itself .


condition ? cf$(1) & rpt.field & cf$(0) : rpt.field


Of course report script can always be used if the expression turns out to be longer by declaring one new field in report script , assigning the right expression in before layout and actually using the same in the layout .

Jordi.Tolra
7th April 2008, 11:24
Thanks Mark and Hitesh!!
It worked.

I was already trying something with cf$ but didn't succeed, I suppose because my report field was a double, but if I convert it to string before printing they I can use the solution that you propose.

thanks again

Salutacions