I am creating a formula to strip out a number from a URL. However, this URL takes on two formats and so I need to use an if statement to take two different actions.
This was my original formula before the if statement which works for the first format.
local stringVar url:= {VIEW_CUST_ReceiverResponseLinks_EMPC.LinkURL};
local numberVar testart := InStr (url,"te=",1);
local numberVar teend := InStr (url,"w=",1);
local stringvar templateid := mid(url,testart+3,teend - testart-4);
tonumber(templateid)
When I tried to incorporate the second format, I got into trouble. I have put local variable declarations inside the if statement because I did not want the report to calculate variables that would not get used.
Here's where my formula is now which is not working.
local numbervar formid :={VIEW_CUST_ReceiverResponseLinks_EMPC.FORMID}
if isnull(formid)
then
local stringVar url:= {VIEW_CUST_ReceiverResponseLinks_EMPC.LinkURL};
local numberVar testart := InStr (url,"te=",1);
local numberVar teend := InStr (url,"w=",1);
local stringvar templateid := mid(url,testart+3,teend - testart-4);
tonumber(templateid)
else formid;
I've tried the following format as well, by putting all variables up front, but I continue to get "The remaining text does not appear to be part fo the formula." Which includes everything after the first line.
local numbervar formid :={VIEW_CUST_ReceiverResponseLinks_EMPC.FORMID}
local stringVar url:= {VIEW_CUST_ReceiverResponseLinks_EMPC.LinkURL};
local numberVar testart := InStr (url,"te=",1);
local numberVar teend := InStr (url,"w=",1);
local stringvar templateid := mid(url,testart+3,teend - testart-4);
if isnull(formid)
then tonumber(templateid)
else formid;
Any suggestions?
This was my original formula before the if statement which works for the first format.
local stringVar url:= {VIEW_CUST_ReceiverResponseLinks_EMPC.LinkURL};
local numberVar testart := InStr (url,"te=",1);
local numberVar teend := InStr (url,"w=",1);
local stringvar templateid := mid(url,testart+3,teend - testart-4);
tonumber(templateid)
When I tried to incorporate the second format, I got into trouble. I have put local variable declarations inside the if statement because I did not want the report to calculate variables that would not get used.
Here's where my formula is now which is not working.
local numbervar formid :={VIEW_CUST_ReceiverResponseLinks_EMPC.FORMID}
if isnull(formid)
then
local stringVar url:= {VIEW_CUST_ReceiverResponseLinks_EMPC.LinkURL};
local numberVar testart := InStr (url,"te=",1);
local numberVar teend := InStr (url,"w=",1);
local stringvar templateid := mid(url,testart+3,teend - testart-4);
tonumber(templateid)
else formid;
I've tried the following format as well, by putting all variables up front, but I continue to get "The remaining text does not appear to be part fo the formula." Which includes everything after the first line.
local numbervar formid :={VIEW_CUST_ReceiverResponseLinks_EMPC.FORMID}
local stringVar url:= {VIEW_CUST_ReceiverResponseLinks_EMPC.LinkURL};
local numberVar testart := InStr (url,"te=",1);
local numberVar teend := InStr (url,"w=",1);
local stringvar templateid := mid(url,testart+3,teend - testart-4);
if isnull(formid)
then tonumber(templateid)
else formid;
Any suggestions?