Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Smartform... text

Former Member
0 Likes
1,242

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,167

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

7 REPLIES 7
Read only

Former Member
0 Likes
1,167

You can use different text for each address line and write condition in 'conditions' tab for that text.

Pranav

Read only

Former Member
0 Likes
1,167

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.

Read only

Former Member
0 Likes
1,167

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

Read only

Former Member
0 Likes
1,167

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

Read only

Former Member
0 Likes
1,168

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

Read only

Former Member
0 Likes
1,167

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к

Read only

Former Member
0 Likes
1,167

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