Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formulas Post Reply Post New Topic
Page  of 2 Next >>
Author Message
takugian
Newbie
Newbie


Joined: 17 Oct 2012
Online Status: Offline
Posts: 24
Quote takugian Replybullet Topic: Formulas
     Posted: 19 Oct 2012 at 3:06am
Hi guys!

I'm a beginner in crystal and I have to learn fast as possible to use the system.

I finished the design of report almost as I want, now I need to learn more about formulas.

What I want exactly is moviment a field in according of its value. If value from db is 1, the field moves to x position. If value is 2, the field moves to other x position.

This "field" can be the field of bd or a field "Text Object".

Thanks!!!
IP IP Logged
shanth
Groupie
Groupie


Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
Quote shanth Replybullet Posted: 19 Oct 2012 at 4:14am
Not sure if there is better way, but how I dealt with this was,
create two graphs: at two postions/sections
Format Chart/section->Supress each one based on your db value
IP IP Logged
takugian
Newbie
Newbie


Joined: 17 Oct 2012
Online Status: Offline
Posts: 24
Quote takugian Replybullet Posted: 19 Oct 2012 at 4:22am
But I don't know how to do it. My boss ask for that. It's a new model of report that it will be implemented here.

Well, I want to do the following...

I have two spaces in my report. Two "boxes". If DB's value is 1, "box 1" will mark with "X". If 2, "box 2" will mark with "X".

I think I have to create a formula and write the code. But I don't know anything about crystal code...

I thought about create one text object with value x and moves it in according of db's value to mark the "box".

I also thought about create two text objects with value "" (empty). In according of db's values, I will change the value of right text object to "x".

Example...

Cattegory's value = 1

-----------
| ASS | TRE |
-----------
| X        |     |
-----------

Cattegory's value = 2

-----------
| ASS | TRE |
-----------
|        | X |
-----------
IP IP Logged
shanth
Groupie
Groupie


Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
Quote shanth Replybullet Posted: 19 Oct 2012 at 4:45am
ooops how do the Chart thing came, please ignore my above message, its not related to you,
-----------

create TWO formulas:

fORMULA1:    IF {DB_FIELD}= 1 THEN 'x' ELSE ' '
FORMULA2:    IF {DB_FIELD}= 2 THEN 'x' ELSE ' '
Place them at required position: right click on that object and right click on Object-> Format Field->Goto Boarder Tab->select desired linestyle(in you case single for left & right)
Hope this helps!

IP IP Logged
takugian
Newbie
Newbie


Joined: 17 Oct 2012
Online Status: Offline
Posts: 24
Quote takugian Replybullet Posted: 19 Oct 2012 at 6:20am
Thanks! This works as I want exactly!!!

Now, more one question please. I need to use images in my report.

I have a field in the DB that can have four kind of values. This values are strings. In according of the value, I need to print one image.

Example.. if "STRING A", I print a green circle, if "STRING B", I print a yellow circle, etc etc etc.

How can I do that? Thanks so much!!!

IP IP Logged
shanth
Groupie
Groupie


Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
Quote shanth Replybullet Posted: 19 Oct 2012 at 8:12am
For each Image Object
Right click (OLE/Object) -> Format Graphic ->Check Suppress box-> Click X2 -> write similar formula in each
For Green Circle:
{Field}<> "String A" [ Green Circle Image shows only when {Field}="String A"]
For Yellow Circle:
{Field}<> "String B" [ Yellow Circle Image shows only when {Field}="String B"]
Follow the same if you have more images then
select all images align to same position , so they overlap each other and enables/ suppress when condition satisfies in Suppress - X2
IP IP Logged
takugian
Newbie
Newbie


Joined: 17 Oct 2012
Online Status: Offline
Posts: 24
Quote takugian Replybullet Posted: 21 Oct 2012 at 11:47pm
Originally posted by shanth

For each Image ObjectRight click (OLE/Object) -> Format Graphic ->Check Suppress box-> Click X2 -> write similar formula in eachFor Green Circle:{Field}<> "String A" [ Green Circle Image shows only when {Field}="String A"]For Yellow Circle:{Field}<> "String B" [ Yellow Circle Image shows only when {Field}="String B"]Follow the same if you have more images then select all images align to same position , so they overlap each other and enables/ suppress when condition satisfies in Suppress - X2



Hi, friend!

I don't work on weekend, but now I'm back haha

I understood what you said, but my problem is different. I have a table with many rows. In this table, I have a field called "SIGN". At this point comes my example... If SIGN is GREEN, the word "GREEN" becomes a image of a "GREEN SIGN". If yellow.... etc etc etc.

Thanks!!
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 22 Oct 2012 at 5:11am
When you say "Green" becomes an imagine, are you saying that you want to only see the green sign and not text?

Its a little confusing, I think shanth answered the question.

Could you show what you want visually?
IP IP Logged
takugian
Newbie
Newbie


Joined: 17 Oct 2012
Online Status: Offline
Posts: 24
Quote takugian Replybullet Posted: 22 Oct 2012 at 5:55am
Originally posted by comatt1

When you say "Green" becomes an imagine, are you saying that you want to only see the green sign and not text?

Its a little confusing, I think shanth answered the question.

Could you show what you want visually?


Sorry. I can't. There is a boring security system here. I can't show images of report.

Well... Imagine a table filled by registers...

ID / NAME / SIGN
1 / A / GREEN
2 / B / GREEN
3 / C / BLACK
4 / D / GREEN
5 / E / YELLOW
...

In the DB works this way. But in the report, I don't want this. My report must print a image, not a text. If "GREEN" then print a GREEN SIGNAL. If "BLACK" then print a BLACK SIGNAL. The text is replaced by an image. It would be like this...

ID / NAME / SIGN
1 / A / GREEN SIGNAL
2 / B / GREEN SIGNAL
3 / C / BLACK SIGNAL
...

Do you understand?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Oct 2012 at 6:25am

your not quite explaining what the signals are. You stated they are "images" so we are going to assume you are using a file type of jpeg or something similar as the "image". You can insert multiple images into the Sign portion of the report and conditionally suppress them.

If your "image" is more like a WingDings font that you want to change colors that is different and you will need to clarify.
IP IP Logged
Page  of 2 Next >>
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