2009 Feb 06 7:04 PM
Hi Experts,
I have a requirement in smartform.....
I need to show the some text if it is not equal to space.
I have created one text in main window. in the text general attributes I written the logic like below
Z4 ,, 'Name: ' &WA_CUSADRS-NAME1&
/: IF &WA_CUSADRS-ZSTADD1& NE SPACE
Z4 ,,'Address1' &WA_CUSADRS-ZSTADD1&
/: ENDIF
/: IF &WA_CUSADRS-ZSTADD2& NE SPACE
Z4 ,,' Address2' &WA_CUSADRS-ZSTADD2&
/: ENDIF
Z4 ,, 'Country: US'
In the output ..
I am getting like below.( If condition is not working). eventhough Address2 field is blank, it is showing blank line. Could you pls help me, how to eliminate address2 if it is blank
Name: XXXX
Address1: 35456
Address2:
Country: US
Thanks in advance
Raghu
2009 Feb 07 4:49 AM
hi raghu
there is one alternative way ..
double click the text which u want to check the condition as ne to space??
there is a condition tab after the output option tab.
select the conditon tab
give the fieldname ,
in the relational operator field click on it. it shows all the relation operators
choose not equal to operator.
select it
enter
in the comparision field type the SPACE.
hope it l be helpful.
regards
surender
2009 Feb 06 7:11 PM
You can use different text for each address line and write condition in 'conditions' tab for that text.
Pranav
2009 Feb 06 10:56 PM
Another option would be to use an Address instead of a text. Simply provide the address number in the General Attributes tab of the Address and it will obtain the address details for you including the customer name. This way, you don't have to put in code to evaluate if there is a value or not. The Address will come out like this:
Customer Name
Street Address 1
Street Address 2
City State Zip
Country
And if any of these does not have a value, the spaces are removed automatically. Example, if there is no Address 2, it comes out as:
Customer Name
Street Address 1
City State Zip
Country
In this case however, you will not have the field titles:
Name:
Address1:
..
etc.
2009 Feb 07 4:38 AM
Hi,
In address field if there is any numeric data types then it may contain zero as the initial value,in that case if we check with SPACE ,IF condition will become false.
So we can check with INITIAL .
You can use the code like this.
Z4 ,, 'Name: ' &WA_CUSADRS-NAME1&
/: IF &WA_CUSADRS-ZSTADD1& IS INITIAL
Z4 ,,'Address1' &WA_CUSADRS-ZSTADD1&
/: ENDIF
/: IF &WA_CUSADRS-ZSTADD2& IS INITIAL
Z4 ,,' Address2' &WA_CUSADRS-ZSTADD2&
/: ENDIF
Z4 ,, 'Country: US'
Hope this works,
Regards,
jaya
2009 Feb 07 4:47 AM
Hi,
try this check if it is not initial.(then only you need to print.)
Z4 ,, 'Name: ' &WA_CUSADRS-NAME1&
/: IF &WA_CUSADRS-ZSTADD1& IS not initial.
Z4 ,,'Address1' &WA_CUSADRS-ZSTADD1&
/: ENDIF
/: IF &WA_CUSADRS-ZSTADD2& is not initial.
Z4 ,,' Address2' &WA_CUSADRS-ZSTADD2&
/: ENDIF
Z4 ,, 'Country: US'
Hope this works
2009 Feb 07 4:49 AM
hi raghu
there is one alternative way ..
double click the text which u want to check the condition as ne to space??
there is a condition tab after the output option tab.
select the conditon tab
give the fieldname ,
in the relational operator field click on it. it shows all the relation operators
choose not equal to operator.
select it
enter
in the comparision field type the SPACE.
hope it l be helpful.
regards
surender
2009 Feb 07 9:08 AM
Hi,
In smartforms we put conditions by using the conditions tab, given for each node.Specify ur condition there it will definately work.
кu03B1ятu03B9к
2009 Feb 07 10:24 AM
hi ,
1.u can use a different text for address2 and before that in the code not u check for initial .if it is initial,u set a variable and in the text not for address2 , in the condition tab , give the variable condition.
2.for the one ur using ,otherwise just before the text node u create a code node and check for initial of address2.instead of hardcoding it as address2 u create a vraible to be displayed.if it is initial,then clear the variable for adress 2 so that address 2 wont be displayed.but one problem here thr will be space before the next element displayedie:in ur case country