- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Well, to put my response in one single word:
Ewwww!
What's happening after then and the else though? I mean, shouldn't those strings be like, assigned to something? I never used CR, its the 1st thing I choose to not install when installing VS so I've never used it but....this definitely looks just...ugly.
Admin
I love how each case has "Visitors to " + 'New Zealand' + " require..." rather than use "Visitors to New Zealand require...". Also note the differing choice of " and ' quote characters for the string literals.
I'd bet that the author of the code wrote the final catch-all case first, and then wrote the known cases in the same manner. Either way, it's ugly as hell!
And maybe I'm just ignorant of Crystal Reports, but where does each constructed string end up? Magically returned from the function?
Admin
I know little about the product, but the name "Crystal Reports" sucks.
Admin
Totally WTF!
Admin
Were they trying to do something like:
<font face="Courier New">else if {crGetPassportDetails;1.Name} = <font color="#ff0000">'DAYTONA BEACH'</font> then "Visitors to " + <font color="#ff0000">'the Spring Break Capital '</font> + " require a full passport which must be valid for " + {@MinMonths} + " months after departure from this country." </font>
Admin
<font style="BACKGROUND-COLOR: #efefef">Crystal Reports is a wtf in of itself. The last version I worked with was 8.5. It has been a thorn in my side for years now. Not knowing the version it was written in, I am not sure if it could have been written more simply.</font>
Admin
in a crystal reports formula, the last statement executed that returns a value is what is the formula returns. a statement can be just a value, like in this example -- not that the if statements have a then clause of simply a string expression.
some notes:
1) clearly, if proper case is important, it should be stored in the database; however, perhaps this was not possible for the designer of this report
2) I don't think Crystal has a ProperCase function; I may be wrong, but I don't think it does
3) early versions of Crystal (before 8.0, I believe) would not let you iterate or loop in a formula, so you could not step through a string and calculate the proper case of field that way. Execution of a formula was purely sequential (with conditional branching).
4) none of the above completely excuses this code, however -- especially (as pointed out) the odd string concatenation being done, the mixing of quote styles, and repeating the literal over and over ....
Admin
it isn't just the name...
Admin
The other aren't the "Known cases" -- They are the multi-word ones; the one where the catch-all won't work. (ie, The catch-all would write: "<font size="2">"Visitors to New zealand require..."</font>
Admin
@Jeff - I think that the reason that they used litterals over and over is because you can not declare variables inside a formula, you have to use another formula. I bet someone setup formula for the standard strings, and then someone when "wtf? it would be better if I replaced these "hard coded" formulas with their strings. Yeah that would run faster." lol. Just a guess.
Admin
The string get displayed on the report. This is not a function, just code behind a field placed on the report.
Admin
I seriously hat Crystal Reports and would like to send out a big F-U to its creators...
[8o|]
Admin
This is rather normal CR code, unfortunately.
It looks bad but (apart from the weird concatenation) is probably just the way life is in CR.
CR sucks but has little competition.
Admin
Crystal isn't that bad.
Most people who "hate" it don't really know how to use it.
Again, before version 8.0, you would sometimes see formulas like this. But since then, no reason for this at all. formulas can have local or global variables. you can loop through a string if needed, change the case of characters, return results based on conditions, even write custom external functions as dll's if you know how.
If you hate it, explain why. It's not perfect, but it does a pretty good job for the most part. When I hear people say "Crystal sucks" and that's the extent of their argument, what they are saying is "Crystal is too complicated for me, I don't understand it".
Admin
It's obvious now.. the hard coded ones are the ones with two words in the name. All the other ones get caught in the generic one.
Admin
Wow that stinks, but not having Crystal Reports knowledge, I wonder if the coder had any better options. Perhaps Crystal Reports does not support hashtables....[:^)]
Admin
Jeff,
I am admitedly one of the CR haters... I don't like products that are so complicated to use that some people make a living at doing it. Just like Oracle administration.
The curse of CR in the enterprise is, nobody wants to learn it and once you learn it you're going to be doing all the CR stuff for everybody else.. you're stuck.
Time for a new "I Hate Crystal Reports" board too [:)]
- Sergio
Admin
<font style="BACKGROUND-COLOR: #efefef">@Jeff S -
I've had mixed results when using CR.
Most of the applications I've written utilizing it were web-based, and the reports always seemed to work fine within the development environment, but took a total crap when moved to production. Most errors were due to the infamous "Server Logon Failure" (or something like that).
For the most part, working with CR was ok, but deployment was a pain.
It will be interesting to see how Microsoft's Reporting Services stack up...
Dallas
</font>
Admin
Jeff S, you are right, of course. Too many posters here seem ignorant of the products they criticize. Every dev. environment has its warts, we just get used to the warts we see everyday. I use Crystal 8.5 and it's not bad, I've seen worse. FWIW it has an excellent online help system for its somewhat idiosyncratic syntax.
Admin
Oh man, now that is frightening. Love the mixed ' and ". Poor guy just couldn't make up his mind... not about whether to use ' or ", but whether to use something useful to write this in.
Like others, Crystal Reports has always been the first thing that I unchecked in the Visual Studio installation. Ew.
Admin
Sorry, that last anon post was me. [*-)]
Admin
A few notes:
Actually, you can declare variables inside formulas, but no one ever does because the syntax is so counter-intuitive and everyone hates Crystal to begin with. You just want to fix the report and close that horrid application as quickly as possible.
Also, as stated, this is a formula, so there is no need to "return" the string. It's automatically implied that if you leave a dangling literal like so, it becomes the value of the formula. Stupid, yes, but that's how it's done.
I'm the resident expert for Crystal Reports where I work......that is not a statement of esteem, trust me.
My 2 cents.
Admin
I've seen worse, and also met the guy (Warren) who started Crystal with $50k in his Grandma's basement (so he said...)
But what's this mean?:
<font face="Courier New"> if {crGetPassportDetails;1.Name}
Is "crGetPassportDetails" an object and "1.Name" is a field within it?
</font>
Admin
<font style="BACKGROUND-COLOR: #efefef">>><font size="2">Actually, you can declare variables inside formulas, but no one ever does because the syntax is so counter-intuitive and everyone hates Crystal to begin with. You just want to fix the report and close that horrid application as quickly as possible.
------------
See my previous post if you'd like to see the translation for the above statement.
No one uses variables? Just because you can't figure it out doesn't mean no one else can do it!
For those who've never seen crystal before, see if you can guess what these "counter-intuitive" statements are doing:
----
stringvar a;
numbervar b;
datevar c;</font></font>
<font style="BACKGROUND-COLOR: #efefef"><font size="2">a := 'string';
b := 2;
c := date(2003,1,1);
----
By the way, again, in Crystal versions > 8.0, there is an option to use VB-style syntax in formulas. But no one ever reads the manual or bothers to explore the UI to see what options are available; it looks complicated, they throw up their hands and yell "I give up! this thing sucks! " .
If you can somehow track down the little combobox on every formula screen and figure out how to change the setting from "Crystal Syntax" to "Basic Syntax", then you can say:
----
dim i as number
dim b as string
dim c as date</font></font>
<font style="BACKGROUND-COLOR: #efefef"><font size="2">i = 1
b = "hey"
c = DateValue(2003,1,1)</font></font>
<font style="BACKGROUND-COLOR: #efefef"><font size="2">-----
With VB syntax, you can explicitly set the return value and everything, w/o using the other convention of returning the last expression.
And I thought C++ was hard! This is like rocket science!
Anyone need Crystal consulting, let me know....
</font></font>
Admin
Jeff: Crystal sucks.
- Parameter handling (stored procedure datetime, especially)
- Integrated security
I shan't mention the bloated redist, the asinine designer and all those other nifty things.
I've had to deal with it from 4.5 through 8.5, and I am never, ever, ever going back. (Well, give me $200K a year and I'll think about it).
Admin
Here are the three reasons I hate crystal. I have only used 6.0 - 8.0.
1. CRPE ERRR: NO ERROR
2. No useable Export Format - We use a third party Pdf writer to get a decent electronic document from Crystal
3. It prints to this printer but won't print to that printer.
I especilally hate when No. 1 shows up on a single person in a remote office when the application and report works for EVERYONE ELSE in that office. I agree with the above post. I would be most happy if I never had to touch it again.
Admin
<font face="Verdana">For sure I hate Crystal Reports... A colegue of mine made some changes on a report without having a printer installed on his machine, and stupid Crystal Reports saved this, and on all the customers machines nothing happened when they tried to print out the report.
Not to mention the stupid report designer, in which you spend hours to arrange the things as you want...
</font>
Admin
Nothing better to build a long list os posts than commenting on a product that 90% of the people that have used hate with all their energy. This is even more outstanding that the Oracle haters club.
Somebody with more talent than me should go ahead and write a nice alternative to Crystal, backed by a well known brand name, so that companies are willing to adopt. That same person will then be bound for great weath and eternal gratitude from the developers community.
Admin
This code just looks really machine-generated to me. The way it concatenates string literals with + is just not something a human being would do by hand. But I can easily imagine some kind of template-generation script that embeds arbitrary string expressions in a block of code in a loop. In that case, it pretty much has to use the + operator, because the expression being embedded might not be a string literal.
This would also explain the mixture of single and double quotes. The template uses double quotes, the inserted expressions use single quotes. They're presumably coming from different sources. Maybe a the template was written by a coder who likes double-quotes and the inserted strings are coming from a library call that uses single-quotes.
Admin
Crystal... what can I say :)
My favourite error was the wierd and wonderful grouping errors you would get and running totals that just do not work :) I have worked with a lot of crystal reports that have come through many hands and they all make me wanna cry. Anyone like it how when you try to put any OR criteria in the record selection it decides that it will grab everything in all the tables and does the filtering manually?
Sure a lot of this can be *optimised* with some tinkering, after about 2 yrs worth of Crystal reports for our products Ive come across a lot of them. But mostly I say a big F-U to Crystal and write a stored procedure or a view to get around it all :)
A good thing about crystal is.... uh I cant think of it? haha just kidding. The good thing is we can just drop the report file on their machine somewhere and it will run - most of the time.
Personally I'm starting to tinker with the SQL Report writer by Microsoft (I am actually a fan of Microsoft hehe look at them all shudder) and Rave reports that comes with Borland Delphi (Borland for the win).
Have not tried 9-10.5, I've managed to push all the report writing onto our new staff members and all the graduates that come through and let them go through the trauma :) Its a good way to weed out the weaklings before they come near our code. So far its working :)
Lashiec
Admin
Jeff: I hate Crystal too.
At my previous employer I spent 3 years creating custom reports for clients in Crystal.
I used versions 8.5-10 of the IDE and despite things getting better, with each version, I still found plenty of interesting issues with v10.
The most enjoyable of all errors was when reports would become corrupted. You would work on edits to a report and click save and Crystal would simply die. So, figuring you did something wrong, you re-opened report and made one minor change, save. Crystal died -- general protection fault, or similar. You would have to recreate the report from scratch. I ran into this a half-dozen times during my 3 years with Crystal -- several days spent recreating reports from scratch.
Mike
Admin
<FONT style="BACKGROUND-COLOR: #efefef">OK guys, why you blame this piece of code?</FONT>
<FONT style="BACKGROUND-COLOR: #efefef">The author probably evaluated that </FONT><FONT style="BACKGROUND-COLOR: #efefef">writing a code that will convert each word in upper case, except "and", "in", "for" etc, would take him, say, 10 mins, but writing this piece took him 5 mins. He saved 5 mins, and thus saved money for his company. That's wise!</FONT>
Admin
Admin
Mike X 114? Is that "MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike-
MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike-
MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike-
MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike-
MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike-
MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike-
MikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMikeMike"?
Or is it more of a Zipo Bibrok 5 *10^8 thing?
Admin
My extention is 114, not times 114 but very funny none the less. I am sure you guys don't want a big sales pitch in this string, so I wanted to direct you to our website and give you the ability to contact me if youi have interest. But now that I am here, I will tell you why we are better than Crystal. 1. Visual Interactions delivers the "Data Fields" into a user interface, so you map to the data base tables once. 2. Visual Interactions can create a new report from start to finish in minutes not hours. 3. Visual Interactions allows you to slice and dice the data. 4. Visual Interactions automaticly will generate the SQL for you. 5. Visual Interactions is a great new company with an awesome tool for accessing data. 6. I will give a demo (disc or webinar) to anyone that wants to see how we kick Crytal.
Admin
I'm glad you took that as intended. Combine the presence of geeks (or at least one geek) and a possible sideways reference to the Hitchiker's Guide, and that's what you get. Thanks for the 'splanation.
Admin
Stan....would you be willing to take a look at my software? I think you will be impressed at our ability. [email protected] if you want to get in touch off-line
Admin
I'm sure I'm not the only developer with Crystal Reports experience who conveniently omits it from his resume. I can't think of a more painful way to write reports.
Admin
I imagine that the whole thing is actually an expression. That is: the else and ifs are doing the same job as the C ternary operator.