John-S Pretorius
asked on
Crystal Report to detect a change in field
I have a Crystal report sorting by group and within each group I have a specific field "Type" which is a string.
For normal operations generated by the report this field will always show the same result "TAGM" but from time to time I have a violation which will be reported under "WGDC" for the same field.
I am looking for a way/formula that will indicate within each grouping when there is a change.
Your assistance would be greatly appreciated.
John-S Pretorius.
For normal operations generated by the report this field will always show the same result "TAGM" but from time to time I have a violation which will be reported under "WGDC" for the same field.
I am looking for a way/formula that will indicate within each grouping when there is a change.
Your assistance would be greatly appreciated.
John-S Pretorius.
ASKER
I actually need to be able to create a filtered report at the end, that will only show the violations under each group and not short/show any of the other transactions that have no violations.
I was thinking of using a if statement triggering the change and then sorting only the violations or changes under the same group.
Thank you for your suggestion - any other ideas?
I was thinking of using a if statement triggering the change and then sorting only the violations or changes under the same group.
Thank you for your suggestion - any other ideas?
You can use the select expert to filter out and show only the non-TAGM records.
{TypeField} <> "TAGM"
mlmcc
{TypeField} <> "TAGM"
mlmcc
ASKER
I may have not been completely clear about what I'm trying to achieve, I apologize.
Each user has 2 sets of access keys, tagm or wgdc and within a cycle which typically may be entry and exit are only allowed to use one type.
I am looking for just the violations when there is a change of card type usage and don't care about the rest of the valid 'same' type records
Each user has 2 sets of access keys, tagm or wgdc and within a cycle which typically may be entry and exit are only allowed to use one type.
I am looking for just the violations when there is a change of card type usage and don't care about the rest of the valid 'same' type records
So if they start with TAGM you want to see the WGDC records and vice versa.
Add 2 formulas
Name - HasTAGM
If {Type} = 'TAGM' then
1
else
0
Name - HasWGDC
If {Type} = 'WGDC' then
1
else
0
You could group by user
Use group selection as
Sum({@HasTAGM,{NameField}) > 0
AND
Sum({@HasWGDC,{NameField}) > 0
In the group header add a formula
WhilePrintingRecords;
Global StringVar FirstType;
FirstType := {TypeField};
""
Conditionally suppress the detail section with
WhilePrintingRecords;
Global StringVar FirstType;
FirstType = {TypeField}
mlmcc
Add 2 formulas
Name - HasTAGM
If {Type} = 'TAGM' then
1
else
0
Name - HasWGDC
If {Type} = 'WGDC' then
1
else
0
You could group by user
Use group selection as
Sum({@HasTAGM,{NameField})
AND
Sum({@HasWGDC,{NameField})
In the group header add a formula
WhilePrintingRecords;
Global StringVar FirstType;
FirstType := {TypeField};
""
Conditionally suppress the detail section with
WhilePrintingRecords;
Global StringVar FirstType;
FirstType = {TypeField}
mlmcc
ASKER
Just to confirm if they start the day with wgdc and it changes to the other and vice versa I want the report to group them.
This looks good so far and I will test it shortly.
Thanks for your patience, I will give you feedback in a short while.
This looks good so far and I will test it shortly.
Thanks for your patience, I will give you feedback in a short while.
ASKER
I am getting stuck adding a Group header, as I already had a group sorting each user.
Where do I add the indicated 'Group header' - When I run the report without the last 2 instructions I have a clear page, none of my page header or anything.
Any ideas please.
Where do I add the indicated 'Group header' - When I run the report without the last 2 instructions I have a clear page, none of my page header or anything.
Any ideas please.
ASKER
May I kindly request if you could look at the attatched file please - I'm not sure what I'm missing here. QCS-Monthly-Users-Activity.rpt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mlmcc you nailed it - that is really awesome, thank you this is certainly exactly what I was trying to do.
I will award you the points (not that al this about, surely) but I would like to keep it open for a little while longer as I may need to add a scenario where for instance if the first entrance was thru Device #52 (Broadway overhead tag - any one is alowed to start a transaction with this type TAGM and then follow thru with _WGDC as long as it stays at that)
Do you think it would be hard to add something like that ?
Thanks again, I hope we can complete the last request together.
I will award you the points (not that al this about, surely) but I would like to keep it open for a little while longer as I may need to add a scenario where for instance if the first entrance was thru Device #52 (Broadway overhead tag - any one is alowed to start a transaction with this type TAGM and then follow thru with _WGDC as long as it stays at that)
Do you think it would be hard to add something like that ?
Thanks again, I hope we can complete the last request together.
Probably not too tough.
You can close and then we can still continue the discussion if you wish.
mlmcc
You can close and then we can still continue the discussion if you wish.
mlmcc
ASKER
You are the best, thank you so much - I am going to have to follow you :)
ASKER
I have so much to learn but luckily there's people like mlmcc.
ASKER
Good day mlmcc, I am looking at adding another 'check' that needs to be allowed as a valid 'violation' : if the device.design = "broadway Overhead Tag" ignore that first read.
I am also looking into functionality on how to trigger a email/print when such a violation occures. Currently I use easyview to auto generate a report every Hour and just email it out.
Is there a way to run the report and if it finfs a violation do something : email/print ?
I am also looking into functionality on how to trigger a email/print when such a violation occures. Currently I use easyview to auto generate a report every Hour and just email it out.
Is there a way to run the report and if it finfs a violation do something : email/print ?
With the new report you should only get a report if there are violations.
Is the device.design = "broadway Overhead Tag" ever on a second or later record?
mlmcc
Is the device.design = "broadway Overhead Tag" ever on a second or later record?
mlmcc
ASKER
Unless they exit and come back in thru the same entrance. What if we just ignore that device completely ({device.design} = "Broadway overhead Tag" or it also goes by {device.number} = 52)
We are only concerned about this device - ignore it completely.
We are only concerned about this device - ignore it completely.
That was what I was thinking was to add that to the record select as
{device.number} <> 52
mlmcc
{device.number} <> 52
mlmcc
ASKER
Worked perfectly...."What about triggering ?" or running a stored sql request and then emailing/printing when the violation occurs.
Crystal cannot "trigger" anything.
Are you running this from an application?
mlmcc
Are you running this from an application?
mlmcc
ASKER
Yes I'm using easyview to batch generate a bunch of reports and email them out.
ASKER
The report is 100% complete now, thanks to you! You should be proud that I was able to get rid of all unwanted "numberlous" IDTag users that did not have anything asigned yet. I also changed the grouping from >0 to >2 which gives me a true violation report that Rocks.
My last Question if I may please : " How can I output at least some text if there is no violations or data to print" - currently it's just a blank page, and I would like to say maybe : "No Violationf for " {report.date} (Date)
My last Question if I may please : " How can I output at least some text if there is no violations or data to print" - currently it's just a blank page, and I would like to say maybe : "No Violationf for " {report.date} (Date)
You can add a field to the report header or page header that says what you want
You can conditionally suppress it with
Count({SomeField}) > 0
mlmcc
You can conditionally suppress it with
Count({SomeField}) > 0
mlmcc
ASKER
No its not, it just used for a outside building reader which is only used once.
ASKER
I learnt allot, thank you. when can we do the next challenge I am working on something a little more juicy defiantly worth 500 points
ASKER
Please help, I'm trying to add the following to the excisting formula :
I am trying to show if a grouped userIDTag has a duplicate movement (entry) which will show as a 0 in the system - please see image.
I am thinking that :
({ContractParkersMovement. UserIDTag} ,{Contract ParkersMov ement.Move mentType}) <>
next ({ContractParkersMovement. UserIDTag} ,{Contract ParkersMov ement.Move mentType}
should do this but keep getting a error with the formula.
I am trying to show if a grouped userIDTag has a duplicate movement (entry) which will show as a 0 in the system - please see image.
I am thinking that :
({ContractParkersMovement.
next ({ContractParkersMovement.
should do this but keep getting a error with the formula.
Right click the TYPE field
Click FORMAT FIELD
Click the BORDER tab
Click the formula button the the right of BACKGROUND
If CurrentFieldValue <> "TAGM" then
crTeal
mlmcc