You could verify this by testing using something like:
Main Topics
Browse All TopicsI'm pulling some values from an array and trying to parse them a particular way.
When I use snippet #1, the debugvar variable gets populated as follows:
A:A
B:B
D:C
D:D
E:E
G:F
G:G
[etc]
I want to only diplay info when the 2 values are the same, so I tried adding an IF statement to skip dismiliar pairs (e.g., D:C & G:F; see Snippet #2), but for some reason I'm now only getting a small subset of the results of Snippet #1. I only get the following:
A:A
B:B
I don't understand how these variations could be happening. It's all being pulled from an array and the only difference between the two is that IF statement (and, besides, shouldn't a glitch cause *all* comparisons to fail?).
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Yeah, I thought of that. That's why I have a ":" after each, to check for whitespace. There isn't any. (And the two variables are being pulled from the same value in an array, so there couldn't be any.)
Also, even if there were whitespace, the whitespace would be consistent in both cases, so that doesn't explain why D:D would appear in Snippet #1 but not in Snippet #2.
Tx.
Okay, please see below.
So, the problem is that with Snippet #1 (w/o the IF statement), I get
> "Demographics":"Demographi
> "Geography":"Geography":
> "Health Status":"Year":
> "Health Status":"Health Status":
> [etc.]
But with Snippet #2 (w/ the IF statement to eliminate dissimilar pairs), I get
> "Demographics":"Demographi
> "Geography":"Geography":
[nothing else]
It doesn't make sense to me. I don't see how that IF statement should affect anything.
Thanks.
I tracked down the bug. It was "currentcat2" on line 92 above. Should be "currentCat2".
Haven't worked out exactly why the IF statement caused such a difference, but it's working now, so I'm back in business.
I'm going to request that this question be deleted since it turned out to be so trivial. (Duh!)
Thanks.
I just found it easier to read this:
years( 1988, 2008 )
to this:
'1988,1989,1990,1991,1992,
So, it's a personal preference.
Q: will the yearA[ x ].match( i ) function still work since the yearA field is no longer a simple text field?
A: But that's just it, it IS a simple text (string) field. The result of this:
years( 1988, 2008 )
is identical to this:
'1988,1989,1990,1991,1992,
Watch:
That's neat, but there's a small problem. Your code assumes that the numbers are part of continuous ranges, but actually some of questions skip years, which is why I'm working on this. (I need to enable or disable topics depending on the year the user has selected--we don't want a user submitting a report query that will come back empty because options are being shown that are irrelevant to the time range they've selected).
As ugly as it is, I figured this was the simplest way to handle all the possible permutations without creating parsing logic for the variant date info. This way, I can do a simple InString- style check for each year in the time period involved and don't have to parse multiple date ranges (e.g., "1988-2000, 2002, 2004-2006, 2008"). It's ugly, but so long as the years are correct in the array, it's straight forward parse.
If you have a smarter suggestion, I'm all ears, though. I don't like having all those years needlessly cluttering the place up, either.
Thanks.
How many years do you want to exclude? A couple? If so, this may be a good answer. It allows exclusion years to be added to the parameter list. So, to have a range of dates from
1988..2008 without 2001, you would use:
years( 1988, 2008, 2001 )
To be more complicated and specify 1988..2008, then exclude 1988, 2001, 2008, you would use:
years( 1988, 2008, 1988, 2001, 2008 )
of course, this would be better written as: years( 1989, 2007, 2001 ), but it's a reasonable test
Does that make sense?
Well, the script could be re-written to parse a string I suppose. So, that would have to look like:
years( '1988-2008;1988, 2001, 2008' )
or perhaps
years( '1988-2008', 1988, 2001, 2008 )
The choice of a comma separator is because commas are used to separate parameters in a function.
Thanks for the grade & points.
Good luck & have a great day.
Business Accounts
Answer for Membership
by: HonorGodPosted on 2009-06-10 at 12:32:10ID: 24595322
The values may be different because of leading, or trailing spaces, or non-displayable characters.