Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Programming a text object?? Post Reply Post New Topic
Author Message
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Topic: Programming a text object??
     Posted: 17 May 2011 at 2:39am
Hey, all.

I'm trying to do a report where it lists the selected course of someone.
One registers online and chooses the course he/she wants to take. Then I'll print, among all the courses available, an "X" on the course he choose.

(Example)
The courses available are:

- Informatics []
- Comunication []
- Turism []
 ...

People can choose 2 of them, knowing they have a "1st" and "2nd" option. That is what I want to print inside the boxes next to the course name (they print the abreviation of the courses i.e. "inf", "com", "tur" ...)

I added 2 tables for the "option1" and "option2" fields.

What I was trying to do was to put a textbox next to the courses name, and do something like
if option1 = "com" then fill in the textbox next to the course name with "1st" else ""
if option2 = "com" then fill in the textbox next to the course name with "2nd" else ""

But I have over 15 courses, and that would require a lot of the same code over and over just changing the abreviation of each course.

what would you advise me to do and how would I do it?

Thanks in advance.



IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 17 May 2011 at 4:20am
Since the options are in a fixed order you can store it in an array and loop over it.

Have you actually managed to "fill in" the textbox with a value?

Edited by Keikoku - 17 May 2011 at 4:22am
IP IP Logged
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Posted: 19 May 2011 at 11:15pm
Hello and sorry fo the late answer,

I was able to do something like this:

In a bollean next to the Comunication course:

If {Cursos.abreviation} = "com" then  "1º"
else if {Cursos_1.Abrev} = "com" then "2º"
else ""

but this will mean I will have to write this code for every course.
Or I could just put an bollean next to each course name and have another "master" bollean and write all the code there.
Thing is, if the abreviation field is changed on the database, I'll have to re-write the code.



Edited by Goldberg - 20 May 2011 at 1:04am
IP IP Logged
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Posted: 19 May 2011 at 11:25pm
Each abreviation has an ID though.
How can I make something like 

if the abrev = idcourse chosen then


If {Cursos.Abrev} = "com" then  "1º"
else if {Cursos_1.Abrev} = "com" then "2º"
else ""

So that if the abreviation was changed, it wouldn't require recoding the code (i.e. changing the abrev. on the bolleans with the code)






Edited by Goldberg - 22 May 2011 at 9:48pm
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum