Either approach below assumes you have no records that numerically would be >999...
You could do: Right("00" + {customer.strnum},3)
Or I think your last statement is what is messing it up..
local numberVar v_length := 0;
local stringVar v_store := "";
// get the length of the store number field
v_length := Length({customer.strnum});
// evaluate the store number length, if less than three, append zeroes at the beginning
if (v_length = 3) then
v_store :={customer.strnum}
else if (v_length = 2) then
v_store :="0" + {customer.strnum}
else if (v_length = 1) then
v_store :="00" + {customer.strnum}
else
v_store := right({customer.strnum},3);
v_store;