Guest haaron Posted November 8, 2002 Posted November 8, 2002 I'm trying to format a phone number with parenthesis and dashes. Below is the code I was using. {EMPLOYER.PHONEADDR} [1 to 3] + "-" + {EMPLOYER.PHONEADDR} [4 to 6] + "-" + {EMPLOYER.PHONEADDR} [7 to 10] When I check it, I get a message "A statement is expected here" with the cursor placed at the beginning of the code. What am I doing wrong?
Tom Poje Posted November 11, 2002 Posted November 11, 2002 what level of Relius are you on? I tried pasting your statement into a new formula on an existing report I have and I didn't get any error message upon checking it. I am still at 6.0. you also might try using PERSON instead of EMPLOYER, though it shouldn't make a difference.
Guest haaron Posted November 11, 2002 Posted November 11, 2002 I'm on 7.0. I wonder if that's the problem. But, I took this example directly from the online training info I got. Huh. I can't use PERSON because the info I want is the Employer's information. Thanks for the suggestion.
Guest DottleC2 Posted November 11, 2002 Posted November 11, 2002 Hi - Check that you are using Crystal syntax for the formula below (both syntax work fine but this uses Crystal). The below is a formula that I poked into A COPY of one of the fancy statements (Pstdp2.rpt) to get the Employer's phone number, rather than the Employee's phone. Note that you will need to have the Employer file linked - the autolinker for me tried to link up to the person table that my statement was using. I removed the links and relinked by ERID from RPTPLAN to EMPLOYER. The formulas in CRYSTAL syntax is pasted below: //Note:a crystal syntax will error while run in basic syntax. Message //reads something like 'A statement is expected here' see drop box upper right //@fldPhone22 //used Pstdp2.rpt and copied to a file for editing of customized statement. //{PERSON.PHONEADDR} participant's phone number //{EMPLOYER.PHONEADDR} presume this to be Employer's phone number but haven't tested //The link for customized participant statement would be RPTPLAN."ERID" = EMPLOYER."ERID" AND ... etc etc //If Crystal Syntax (will use this for now)-> {Employer.PHONEADDR} [1 to 3] + "-" + {Employer.PHONEADDR} [4 to 6] + "-" + {Employer.PHONEADDR} [7 to 10] //If Basic Syntax (comments are preceded by ' in Basic syntax also //: In order return a value from a formula in Basic Syntax use the special variable named formula. //formula={EMPLOYER.PHONEADDR} [1 to 3] + "-" + {EMPLOYER.PHONEADDR} [4 to 6] + "-" + {EMPLOYER.PHONEADDR} [7 to 10] ///Can Also fill string for blank phone, something like this //stringvar strPhone; //stringvar strResults; //strPhone = Totext({PERSON.PHONEADDR}); ///format a blank phone number //if length(strPhone)>0 then // strPhone:=strPhone //else // strPhone:=space(10); //"("+{PERSON.PHONEADDR} [1 to 3]+")" + {PERSON.PHONEADDR} [4 to 6] +"-" +{PERSON.PHONEADDR} [7 to 10]Basic Syntax This posted message may have inserted return characters, so you may have to interpret the resulting paragraphs. Regards, Bill
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now