I am trying to create a formula that chacks the value of PROF_ALPHA_1 and modifies it if needed based on its value. Then the same thing with the PO_NO. Finally returns either PROF_ALPHA_1, PO_NO or PROF_ALPHA_1/PO_NO based on whether fields are empty or not.
My problem lies with the SP variable for some reason. If both PROF_ALPHA_1 and PO_NO have values it works great. If PO_NO has a value but PROF_ALPHA_1 does not it works great. But if PROF_ALPHA_1 has a value and PO_NO does not it gives me a blank.
<code>
Local StringVar PO;
Local StringVar SP;
if isnull({PROF_ALPHA_1}) then SP:=""
else if {PROF_ALPHA_1} startswith "SP" then SP := {PROF_ALPHA_1}
else if {PROF_ALPHA_1} <> "" then SP := "SP" + {PROF_ALPHA_1}
if {PO_NO} <> "" then PO := {PO_NO}
else PO := "";
if (PO <> "" and SP <> "") then SP + "/" + PO
else if (SP <> "") then SP
else if (PO <>"") then PO
else "";
</code>
Any idea what's going on?
Thanks
Steve
My problem lies with the SP variable for some reason. If both PROF_ALPHA_1 and PO_NO have values it works great. If PO_NO has a value but PROF_ALPHA_1 does not it works great. But if PROF_ALPHA_1 has a value and PO_NO does not it gives me a blank.
<code>
Local StringVar PO;
Local StringVar SP;
if isnull({PROF_ALPHA_1}) then SP:=""
else if {PROF_ALPHA_1} startswith "SP" then SP := {PROF_ALPHA_1}
else if {PROF_ALPHA_1} <> "" then SP := "SP" + {PROF_ALPHA_1}
if {PO_NO} <> "" then PO := {PO_NO}
else PO := "";
if (PO <> "" and SP <> "") then SP + "/" + PO
else if (SP <> "") then SP
else if (PO <>"") then PO
else "";
</code>
Any idea what's going on?
Thanks
Steve