|
-
Feb 10th, 2009, 01:55 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] formula field
i have a formula field. Here is the code:
Code:
stringVar array x1 := "";
stringVar result := "";
numberVar i;
numberVar top := ubound(split({tblJobs.scflist},'|'));
for i := 1 to top do
(
redim preserve x1[i];
x1[i] := split({tblJobs.scflist},'|')[i];
result := result + x1[i];
result := result + chr(10);
);
if {tblJobs.choosescf} and result = "" then "Please Advise" else result;
if {tblJobs.scflist} is null then i get no result. it will not process anything after the for loop. how can i get around this?
-
Feb 10th, 2009, 02:38 PM
#2
Re: formula field
When a Null field is encountered in a formula Crystal immediately stops evaluating the formula and no result is returned.
Add an If statement and check if the field is null or not.
Code:
stringVar array x1 := "";
stringVar result := "";
numberVar i;
numberVar top := 0;
If Not IsNull({tblJobs.scflist}) Then
(
top := ubound(split({tblJobs.scflist},'|'));
for i := 1 to top do
(
redim preserve x1[i];
x1[i] := split({tblJobs.scflist},'|')[i];
result := result + x1[i];
result := result + chr(10);
);
)
if {tblJobs.choosescf} and result = "" then "Please Advise" else result;
-
Feb 10th, 2009, 02:47 PM
#3
Thread Starter
Fanatic Member
Re: formula field
ok. thanks for the info.
when i tried the code but i get an error:
The remaining text does not appear to be part of the formula.
and it is on the very last line.
-
Feb 10th, 2009, 03:15 PM
#4
Thread Starter
Fanatic Member
Re: formula field
this works.
Code:
stringVar array x1 := "";
stringVar result := "";
numberVar i;
numberVar top := 0;
If Not IsNull({tblJobs.scflist}) Then
(
top := ubound(split({tblJobs.scflist},'|'));
for i := 1 to top do
(
redim preserve x1[i];
x1[i] := split({tblJobs.scflist},'|')[i];
result := result + x1[i];
result := result + chr(10);
);
if {tblJobs.choosescf} then "Please Advise" + result else result;
)
else if {tblJobs.choosescf} then "Please Advise"
-
Feb 10th, 2009, 03:32 PM
#5
Re: [RESOLVED] formula field
I think I missed the semi-colon after the after the end bracket of the first If statement.
Code:
result := result + chr(10);
);
);
if {tblJobs.choosescf} and result = "" then "Please Advise" else result;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|