This website is not affiliated with, sponsored by, or approved by SAP AG.

Conditional formatting

Development SAPscript/ Smartforms

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Conditional formatting

Postby sapmanie » Thu Jun 17, 2010 5:38 am

Hi,
I want to change the font based on a condition.

e.g.
If value is a header
description = bold
Else
description = standard

Is this possible? Styles seem to be only applied to the whole element and there's no place for logic.

Thanks.
sapmanie
 
Posts: 483
Joined: Fri Jan 23, 2004 10:39 am

Re: Conditional formatting

Postby Gothmog » Thu Jun 17, 2010 5:57 am

Some additional precisions could help.
Where do you want to do that ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Conditional formatting

Postby sapmanie » Thu Jun 17, 2010 6:02 am

In a smartform. Specifically, it's a variable in a table cell.
sapmanie
 
Posts: 483
Joined: Fri Jan 23, 2004 10:39 am

Re: Conditional formatting

Postby Gothmog » Thu Jun 17, 2010 6:55 am

sapmanie wrote:Styles seem to be only applied to the whole element and there's no place for logic.

Styles define what paragraph and character formats you can use. Only one style per text element, but you can use different character formats inside this text element.

I guess your 'if value is header' condition is misleading, since the table header is distinct form the table main area, so it would be different cells, and text elements.
However, if you want to change the character format depending on a condition, output different text elements (with different character formats) depending on an Alternative node.

(I'm not sure I quite understand your question, so sorry if I'm not addressing your problem.)
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Conditional formatting

Postby sapmanie » Thu Jun 17, 2010 7:04 am

Hi
Yes sorry if I'm not being clear.

I'm outputting a variable (it doesn't have to be in a table, just for my example it's in a cell).
So in the Text element, I have &wa_var&
I can define the style in a number of places: for example by selecting the Paragraph Format in the Text element, or further up the hierarchy by entering a style on the Cell element, or further up still by entering a style on the Row element, and so on.

In sapscript, the code would have looked something like this:
/: if field = "H".
Z1 &wa_var&
/: else.
Z2 &wa_var& "<-- notice the different formatting

Hopefully this is clearer!! Thanks for your help so far!
sapmanie
 
Posts: 483
Joined: Fri Jan 23, 2004 10:39 am

Re: Conditional formatting

Postby Gothmog » Thu Jun 17, 2010 7:20 am

I'd use an Alternative node, then, and output a different text element depending on the condition.
You can set these text elements to 'Start : Append directly' (in the general attributes) if you want to do that inside a text line.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home


Return to SAPscript/Smartforms

Who is online

Users browsing this forum: No registered users and 2 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.