Focal Point
[CLOSED] Difference between PRINT AND SUM

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1517075426

September 28, 2012, 10:55 AM
bohorkez
[CLOSED] Difference between PRINT AND SUM
Hello, What is the exact difference between SUM and PRINT in a MATCH statement?

For example:
  
MATCH FILE FILE1                                                             
SUM FIELD_1                                                          
BY CODE AS KEY                                           
RUN                                                                             
FILE FILE2                                                             
SUM FIELD_2                                                            
BY CODE AS KEY
AFTER MATCH HOLD AS HOLDF OLD-OR-NEW    


Assumming the data contained in the two files is:

FILE_1 FILE_2
------------ ------------
code field_1 code field_2
1 10 1 50
2 20 2 30
4 30 3 40

What would my final result be? What would be the difference if I put PRINT instead of SUM?

Thank you

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.1.4
Windows, All Outputs
September 28, 2012, 11:23 AM
rfbowley
I would suggest you read the section "Fine-Tuning MATCH Processing" in chapter 16 of the Creating Reports with WebFOCUS Language book.

Copy & pasting of about 4 pages iof information is frowned upon by our illustrious admin :-)


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
September 28, 2012, 12:03 PM
Baillecl
When you write SUM at the 'NEW' level, Match is informed that there will be, at most, One Record for a given KEY Value.
So OLD is O,1 for a KEY Value
And Same is NEW
You Use OLD-OR_NEW, so if any KEY value being in the OLD And / Or in the New will give birth
to One single Record in HOLDF File

When You Use PRINT instead of SUM at the New Level, Match Knows that he doesn't know ( and he won't check for each KEY value at the New Level)
What he knows is that (0,n) is the cardinality of New for any Code Value.

When the cardinality is 0,1 (SUM) Match won't hesitate to replicate the values found on the OLD level onto All the instances Brought on the NEW level
Other he won't do that
In the old Days he Wrote Max (Nb Old, Nb New) records. The ith record contained the ith instance Old Level juxtaposed to the ith instance New Level
Now, When You Set CARTESIAN = ON you get closer of SQL Inner Join : Nb Old * Nb New instances out. Each Old Instance being being juxtaposed by All New instances.

Match, often, surprises IT guys.
But it does exactly what the Focus Bible says it does ( and not one fancy it does )

Now I bet for :
Code Field1 Field2
1 10 50
2 20 30
3 40
4 30

I Guess that, with a Sum there won't be Missing Values, like a SegType = DKU son

And with a Print
Code Field1 Field2
4 30 .
Field2 Would be a Missing Value like a SegType = DKM Value

I know that I Know nothing, but that I know.
Focus is real great when he handles cardinality. But for me, it's not a subject for writing on a corner of a table. You've got to have your brains rather intensely concentrated .

Just wait for Tony A and/or Waz to fix your question in two brilliant and funny lines ...
Cordially and Focusely


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
September 28, 2012, 12:07 PM
Baillecl
Should know that Spaces are brought to one by HTML. I bet For :
  
Code Field1 Field2
1 10 50
2 20 30
3    40
4 30 



Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
September 28, 2012, 01:53 PM
bohorkez
quote:

You've got to have your brains rather intensely concentrated .

Nothing but the truth

Thank you so much for your help and your time.


WebFOCUS 7.1.4
Windows, All Outputs