Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

imaginary parenthesis, and null subreport...

Status
Not open for further replies.

jcrawford08

Technical User
Nov 19, 2008
71
US
Running CR XI R1, on a SQL environment...

I have two dillemmas with the formula below:

1) I have looked at the parenthesis OVER and OVER and cannot see where I am missing one, but CR insists that I add one ")" to the end, just before the display clause...

2)In situations where the string identified truly does have a colon appearing prior to a paragraph or appearing when no paragraph is present, the formula does not return a value...

stringvar pwrcd;

local stringvar x:={Comments.CommentText};
local numbervar i;
local numbervar cntpar;
local numbervar cntcolon;

for i:=1 to len(x) do(if x=chr(13) then cntpar:=cntpar+1;if x = [":"] then cntcolon:=cntcolon+1;


if cntcolon<=0 or (cntcolon>=1 and cntpar>=1 and instr(x,chr(13))<instr(x,":"))then pwrcd:="No" else
if cntcolon>=1 and cntpar>=0 and instr(x,chr(13))>instr(x,":") then pwrcd:="Yes");
pwrcd


for the instr() comparisons, I've tried sub-ing the actual field name in as well, but to no avail

Essentially, users are supposed to enter "username:password" into the first line of a comment field, this is just a simple formula that should return a "Yes" or a "No" as to whether it was done right...

Any input/help is GREATLY appreciated :)

Not in word only, but in deed also... 1Jn3:18
 
Try this to see the flow better:
Code:
local stringvar x:={Comments.CommentText};
local numbervar i;
local numbervar cntpar;
local numbervar cntcolon;

for i:=1 to len(x) do 
([COLOR=red]//paren start for DO statement[/color]
if x[i]=chr(13) then 
cntpar:=cntpar+1;
if x[i] = [":"] 
then cntcolon:=cntcolon+1;
if cntcolon<=0 or 
([COLOR=red]//paren start for OR clause[/color]
cntcolon>=1 and cntpar>=1 and instr(x,chr(13))< instr(x,":")
)[COLOR=red]//paren end for OR clause[/color]
then
 pwrcd:="No" 
else 
if 
([COLOR=red]//paren start for Else If clause[/color]
cntcolon>=1 and cntpar>=0 and instr(x,chr(13))>instr(x,":")
)[COLOR=red]//paren end for Else If clause[/color]
 then pwrcd:="Yes"
)[COLOR=red]//paren end for DO statement[/color]
;
pwrcd

I do not see any paren issue but try adding a ; after the "Yes"



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
If that fails, try doing the same thing in several separate formula fields. One formula field can reference another and it is not necessary to specify the variables, just use the field name.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Parenthesis figured out - thanks Turkbear! - now for the second dillemma;

I've attached a link to the reports below (01-771s is the main report, the other is the sub-report I'm working with), but here's what's happening:

When I use the {@Check} formula (located in the sub report), it will not return a "Yes", but only either "No" or blank; when I remove the {@Check} and simply use suppression to display a "Yes" or "No" textbox, I still get null values in the report where the subreport doesn't display. But I've noticed it's only on ones that should be reading "No"...

I would prefer to have the formula working, as when I use the suprression technique, it works to show if something is blank, but that method isn't designed for more complex evaluations.

Again, any ideas?

Not in word only, but in deed also... 1Jn3:18
 
 http://www.mediafire.com/?n7i27oarb72ho8j
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top