Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nesting If statements 1

Status
Not open for further replies.
Jan 20, 2003
41
US
What is the best way to create a formula that can execute multiple lines? I would like to also like pad the end of the Insurance_no with spaces if they are less than 7.


IF {1005680VW_SERVICE_SUPPLY.VISIT_INS_CODE}= 'PA' THEN
LEFT({1005680VW_SERVICE_SUPPLY.VISIT_INS_NO},7)
ELSE IF


({1005680VW_SERVICE_SUPPLY.PRIMARY_INS_CODE}) = 'PA'THEN
lEFT({1005680VW_SERVICE_SUPPLY.INSURANCE_ID_NO},7)

 
I'm not sure what you mean by execute multiple lines, what you posted is correct if you want to take the
{1005680VW_SERVICE_SUPPLY.VISIT_INS_NO}
for those that have
{1005680VW_SERVICE_SUPPLY.VISIT_INS_CODE}= 'PA'
and if not take the
{1005680VW_SERVICE_SUPPLY.INSURANCE_ID_NO}
for those that have
({1005680VW_SERVICE_SUPPLY.PRIMARY_INS_CODE}) = 'PA'

This should supply the padding you seek:

IF {1005680VW_SERVICE_SUPPLY.VISIT_INS_CODE}= 'PA' THEN

if len(trim(LEFT({1005680VW_SERVICE_SUPPLY.VISIT_INS_NO},7))) < 7 then
{1005680VW_SERVICE_SUPPLY.VISIT_INS_NO} + replicatestring(&quot; &quot;,7-(len(trim({1005680VW_SERVICE_SUPPLY.VISIT_INS_NO}))))
else
left({1005680VW_SERVICE_SUPPLY.VISIT_INS_NO},7)

and continue on with your else ifs

-k
kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top