I have a define field that is created by the following:
IF "C&C Code" EQ 'VDIG01' THEN 'Digital Homes' ELSE IF "C&C Code" IN ( 'VPEXS' , 'VBEXS' , 'VNEXS' , 'VPBAS' , 'VBBAS' , 'VNBAS' , 'VDIG01' ) THEN 'Basic Subs' ELSE IF "C&C Code" EQ 'VPEXM' OR 'VBEXM' OR 'VNEXM' OR 'VPBAM' OR 'VBBAM' OR 'VNBAM' OR 'VPDIM' OR 'VNDIM' OR 'VBDIM' THEN 'EBU Room Count' ELSE IF "C&C Code" EQ 'VPDIS' OR 'VBDIS' OR 'VNDIS' OR 'VPDMX' OR 'VBDMX' OR 'VNDMX' THEN 'Digital Programming' ELSE IF "C&C Code" EQ 'VQD00' OR 'VQS00' OR 'VQMA0' OR 'VQSL0' OR 'VQTMI' OR 'VQTT6' OR 'VQTQU' THEN 'Set Top Boxes' ELSE 'UNKNOWN CATEGORY'
I then have another define field that gets a quantity using this:
IF "Period" EQ d_prd AND "C&C Code" EQ 'SWDS1' THEN "Quantity" * 5 ELSE IF "Period" EQ d_prd AND "C&C Code" NE 'SWDS1' THEN "Quantity" ELSE 0
The issue is that when I use that define field and do a SUM, it not including the amounts from the Digital Homes category in the Basic Subs category. Both categories are created just fine, but the SUM isn't happening like I think it should. What have I done wrong?This message has been edited. Last edited by: FP Mod Chuck,
So, your field is Digital Homes if and only if C&C Code is VDIG01 but it's Basic Subs when it's one the 7 values you list (including VDIG01) which are essentially OR'd.
You have an overlap of values.
WebFOCUS 8204, Unix, Windows
Correct, I knwo they overlap, I am trying to duplicate the results of an excel spreadsheet, however that is proving tough to replicate all the data manipulation that is possible in Excel here on this platform.
I was basically reaching out to see if I was missing anything or if anyone knew how to get around it.This message has been edited. Last edited by: Trentj,
Do you want to create one column or multiple columns?
Why I ask is because you want to count a field in both the catagories which is part of the same column.. that is a bit confusing. In your excel sheet is are all these Catagories different columns or rows of the same column?
Any tool including excel will never evaluate Else part if the "IF" part is true..
that's the nature of IF ELSE statement..
In Focus since 2006
It creates both categories I am assuming due to the other codes in the basic subs. The Sum just omits it from the one category. That's why I am confused, the sum is what is omitting not the category. The sum has nothing in it besides looking for the one specific condition and in both basic subs and digital homes categories it falls within the ELSE condition, not the IF Also, it isn't a condition in Excel that is combining the two it's adding specific columns.This message has been edited. Last edited by: Trentj,
As I said earlier IF ELSE will check the conditions sequentially.
If the condition is true for one statement it will not go and check the condition in the next statement irrespective if that is an IF or Else IF statement.
You need to understand that if the condition is met for Digital Homes it will not go and evaluate the condition for Basic Subs.
My assumption is with the help of the above statement you are either creating a Define or a Compute field.
Even if you will use PRINT it will give you the same results as it can only assign one value to the field based on the condition.
In Focus since 2006
I think that based on previous different answer and above sentence you should ask yourself this :
What is the data source ?
Is there any manipulation done on data prior to produce that Excel result ?
On the second one, it seems that the answer is yes. As per stated previously, you cannot have tow conditions meet within the same IF statement so, data has probably been manipulated.
WF versions : Prod 184.108.40.206M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
Thank you to all. I understand why it isn't happening now (the digital homes category is for the VDIG01 only so when the SUM of my other define field is evaluated for that category, it is only counting the quantity for that code. Where the Basic Subs category, has all the other codes EXCEPT the VDIG01 cause it was evaluated in the DIGITAL HOMES category so the SUM for the second define field omits that field cause it doesn't exist in the first define field definition.)
Sorry if this question drove everyone nuts, I just mainly wanted to make sure I wasnt missing anything. I have another format of the report where I have define fields for each of the categories, then I can sum the basic sub category and digital homes define fields to get a total field and that works. I just can't get the difference between the two period results to show below in an excel like fashion. thanks to all that replied and again I apologize if it seemed like such a noob question.
Welcome to Focal Point! No need to apologize that is what this forum is all about!
When a thread is done you can go back and edit your first post and change the summary to have the word [SOLVED} or [CLOSED] at the beginning so everyone knows there is some kind of resolution.
Thank you for using Focal Point!
Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
|Powered by Social Strata|