Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Hide part 2 Post Reply Post New Topic
Author Message
Wosp
Groupie
Groupie
Avatar

Joined: 05 Sep 2012
Location: Sweden
Online Status: Offline
Posts: 45
Quote Wosp Replybullet Topic: Hide part 2
     Posted: 21 Oct 2014 at 1:29am
Hi got help from z9962 with a formula to hide part of data. then I found that I had to do an exception and added the first row to the formula and this works fine.

if {AO.MOT} = "MEK/DAGREP" then {AO.MOT} else
IF instr({AO.MOT},"/")>0 THEN
left({AO.MOT},instr({AO.MOT},"/")-1)
ELSE
{AO.MOT}

Now I found some more to exclude but how do I add more?
I got MEK/DAGREP now but want to add MEK/POOL and maybe some more later on
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 21 Oct 2014 at 3:09am
Use below logic..
 
if {AO.MOT} = "MEK/*" then {AO.MOT} Else .....
 
--Praveen G

 
Praveen Guntuka,
praveen_guntuka@yahoo.com
IP IP Logged
Wosp
Groupie
Groupie
Avatar

Joined: 05 Sep 2012
Location: Sweden
Online Status: Offline
Posts: 45
Quote Wosp Replybullet Posted: 21 Oct 2014 at 3:57am
Originally posted by praveeng



Use below logic..
 
if {AO.MOT} = "MEK/*" then {AO.MOT} Else .....
 
--Praveen G
 


No, didn't work. Only displays MEK now. The problem is that I would like to separate them. There are MEK/DAGREP that means repair/group of repairmen then I want to show them but if it is MEK/JAMES it means repair/single repairman. I don't want to display name on single user just MEK, but if it is a group of repair I want to show it like MEK/DAGREP.

Example I want all to show just MEK except if its MEK/DAGREP or MEK/POOL or even if its another startword like ELC/DAGREP. I want to specify them individualy.

I hope I didn't confuse you with this explanaition, got a little dizzy myself when I wrote it
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 21 Oct 2014 at 10:58am
Does this field alwasy have "/" once in it?
if left({AO.MOT},4) <> "MEK/" then {AO.MOT} else
if split({AO.MOT},"/")[2] in ["DAGREP","POOL"] then {AO.MOT} else 'MEK'
IP IP Logged
Wosp
Groupie
Groupie
Avatar

Joined: 05 Sep 2012
Location: Sweden
Online Status: Offline
Posts: 45
Quote Wosp Replybullet Posted: 21 Oct 2014 at 7:30pm
Originally posted by DBlank

Does this field alwasy have "/" once in it?

if left({AO.MOT},4) <> "MEK/" then {AO.MOT} else

if split({AO.MOT},"/")[2] in ["DAGREP","POOL"] then {AO.MOT} else 'MEK'


I think there is something wrong with the data in POOL, I tried with another and that worked perfectly, like this:

if {AO.MOT} = ["MEK/DAGREP","PLAT/SVETS"] then {AO.MOT} else
IF instr({AO.MOT},"/")>0 THEN
left({AO.MOT},instr({AO.MOT},"/")-1)
ELSE
{AO.MOT}

If I switch PLAT/SVETS to MEK/POOL it shows only MEK

Thank you for your efforts...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Oct 2014 at 4:23am

break each part of the formula down and see what is not what you want.

if left({AO.MOT},4) <> "MEK/" then {AO.MOT}
--this check the first 4 characters and if they are not = "MEK/" then it always uses the original value. otherwise it goes to the next check.
if split({AO.MOT},"/")[2] in ["DAGREP","POOL"] then {AO.MOT}
--this splits the MOT (wghich now includes onl values that start with MEK/) into an string array for each value between a "/" then compares the second array value to see if it is DAGREP or POOL. If this condition is met it it returns the original MOT value
else 'MEK'
-- if neither of the first two conditions are met then it returns the standard string of 'MEK' which should equate to the original value being some version of "MEK/x" where x is not DAGREP or POOL
 


Edited by DBlank - 22 Oct 2014 at 4:25am
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