Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Hide / Unhide group of objects based on field` Post Reply Post New Topic
Author Message
branners
Newbie
Newbie
Avatar

Joined: 07 Mar 2011
Online Status: Offline
Posts: 2
Quote branners Replybullet Topic: Hide / Unhide group of objects based on field`
     Posted: 07 Mar 2011 at 2:55am
Hi guys, please help me as I have tried everything to get this right but getting more stuck as I go.

I have one pic object and one text object per region (db field) that needs to be shown per that region.

There are 5 regions each with one pic object and one text object and based on the db region that respective text and pic object should be showm.

How is this possible?
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 07 Mar 2011 at 3:09am
By region, I'm assuming you mean the "region" that is like "a particular region of the city".

I'm guessing in the end you would have a list of regions in the details section, and for each detail you would have your custom text object and pic object (to give a further description of that region).

And so you are trying to find a way to associate the pic/text objects you have with each record?

ie:

regionA - PicA, TextA
regionB - PicB, TextB
regionC - PicC, TextC
...



Edited by Keikoku - 07 Mar 2011 at 4:30am
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 07 Mar 2011 at 4:18am
Alright so I did some experiments and have found a solution that may work for you. I am working with CR XI, so the instructions may be different for you (or may not even work, if it's really old)

For the pictures, you would store the images together somewhere in a fixed location. For this example, my images are stored at

D:\reports\my_report\images\

The process will be set up in two parts

First, you need to have a picture object which the formula will act on.

1. insert a picture (can be any picture, you just need a picture object on your report)
2. right-click on the picture
3. click on the picture tab
4. at the bottom of the window, you will see a "graphics location" field.
5. Click on the X-2 to define the formula.

Then, you need to write the formula that specifies the location of your images as well as the conditions for displaying them.

So in your case, your formula would look like


if ({table.region} = "some region") then
"D:\reports\my_report\images\some_img.jpg"
else if ({table.region} = "some other region") then
"D:\reports\my_report\images\some_other_img.jpg"
...


This basically sets the location of your image file.

Once this is done, you can just drag the picture object to your details section and the correct image should appear depending on the value of "region"

For the text object, you may consider just defining a formula that will determine what text you want to display and drag that formula into the details section.

If you require formatting, you can simply right-click the formula object on your report and click "format field", then stylize it with the border and font tabs. You can even define how it should be styled BASED on the values that the DB returns via styling (formatting) formulas.

I use this text display method quite often when the text is dynamic and dependent on the tables. For instance you might have an employee table with their e-mails. You can write a formula to display the e-mail, and format it as a hyperlink that will run your e-mail client (by appending the field and the proper words) when you click on it.

Edited by Keikoku - 07 Mar 2011 at 4:30am
IP IP Logged
branners
Newbie
Newbie
Avatar

Joined: 07 Mar 2011
Online Status: Offline
Posts: 2
Quote branners Replybullet Posted: 07 Mar 2011 at 11:42pm
Mate, I would just like to thank you for the effort you put into helping me. It is well appreciated and I am very gratefull.

Regards,
Byron

Edit: Worked like a charm mate, again thank you very much.

Edited by branners - 08 Mar 2011 at 12:31am
IP IP Logged
Navani
Newbie
Newbie


Joined: 24 Mar 2011
Online Status: Offline
Posts: 1
Quote Navani Replybullet Posted: 24 Mar 2011 at 2:58am
Hello..
I'm developing the report of each student in the class.
I need to display the image of student for his record.
I'm using crystal reports 11 and visual studio 2010.
Can anyone suggest me the solution?
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 24 Mar 2011 at 3:22am
Originally posted by Navani

Hello..
I'm developing the report of each student in the class.
I need to display the image of student for his record.
I'm using crystal reports 11 and visual studio 2010.
Can anyone suggest me the solution?


You should start your own topic, but for displaying the images in crystal you can follow the procedure I wrote up there for displaying images for each detail.

I don't know what kind of application you are writing though.
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