Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal XI - Need to Compare Detail to Header Valu Post Reply Post New Topic
Author Message
kitty_cali
Newbie
Newbie
Avatar

Joined: 26 Nov 2014
Online Status: Offline
Posts: 3
Quote kitty_cali Replybullet Topic: Crystal XI - Need to Compare Detail to Header Valu
     Posted: 26 Nov 2014 at 1:00pm
I need to create a report that compares specific data elements of customer addresses. The data elements are payment terms, delivery terms, etc.   Our addresses are given IDs – 01, 02, 03, etc. The issue is that I need to compare the data from IDs 02, 03, 04… to the same data element value in Address ID 01. 01 is being treated as the master record. When a difference is found I need to print the Dddress 01 value and the Address ID and data element value that is different.

So far I've done the following:
Created Group on Cust_Number (this is the only group in the report)
Created a formula that creates and sets a variable to capture the 01 Address data element (I’ve created one for each element) – and placed the formula in the Cust_Num group header. Example code for the one of the variable formulas:
global stringvar delivery_term;
delivery_term := if {CUST_ORD_CUSTOMER_ADDRESS_ENT.ADDRESS_ID}= '01'
then {CUST_ORD_CUSTOMER_ADDRESS_ENT.DELIVERY_TERMS};

I placed the data element fields in the Details section - delivery terms, payment terms, etc.
I placed a conditional suppress formula on each field similar to this -
if {CUST_ORD_CUSTOMER_ADDRESS_ENT.DELIVERY_TERMS}={@Add 01-Delivery_Term-Init} then true;

This seems to be working but only on the first detail record which is Address 01. It isn't working on the remaining detail records (Addresses) for the Customer. For some reason it’s not recognizing the variable when I compare to the other Address IDs records.

What am I missing?
Any and all help is greatly appreciated.


Edited by kitty_cali - 28 Nov 2014 at 1:24pm
IP IP Logged
kitty_cali
Newbie
Newbie
Avatar

Joined: 26 Nov 2014
Online Status: Offline
Posts: 3
Quote kitty_cali Replybullet Posted: 03 Dec 2014 at 12:52pm
Can this be done in Crystal?
IP IP Logged
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Posted: 03 Dec 2014 at 10:06pm

A good way to trouble shoot variables is create a formula to display the variable value

global stringvar delivery_term;

Place this formula in different locations to see what is been returned.

How is it not working on the other records?

Remember with variables the formula field needs to be placed on the report.

 

IP IP Logged
kitty_cali
Newbie
Newbie
Avatar

Joined: 26 Nov 2014
Online Status: Offline
Posts: 3
Quote kitty_cali Replybullet Posted: 04 Dec 2014 at 5:36am
Hi z9962 -

Gosh I wish I could paste a screen shot in here....would make it much easier to explain. I don't have a public URL where I can place the image. :o(

I placed the variable formula in the group header - which is Customer.
global stringvar delivery_term;
delivery_term := if {CUST_ORD_CUSTOMER_ADDRESS_ENT.ADDRESS_ID}= '01'
then {CUST_ORD_CUSTOMER_ADDRESS_ENT.DELIVERY_TERMS};

The problem is that I need this value to be available (probably not the right word) to be compared with the remaining Detail records in the group - which are the other address ID's.

What I mean by not working is that the value for the formula is returning 'null' for the other address IDs.
I created another formula that calls the variable formula and placed it on the Detail line. The only line it's returning a value is Address ID 01 - which makes sense...

Is there some other crystal magic that I can use that will return the value for address ID 01 to compare to the other IDs?

Hope this makes sense. Thanks so much for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Dec 2014 at 4:06am

global stringvar delivery_term;
delivery_term := if {CUST_ORD_CUSTOMER_ADDRESS_ENT.ADDRESS_ID}= '01'
then {CUST_ORD_CUSTOMER_ADDRESS_ENT.DELIVERY_TERMS} else delivery_term;

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