Focal Point
[SOLVED] Quick ?: Where is the doc. for the WITH command? May the 4th be WITH you...

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

May 04, 2016, 03:39 PM
CoolGuy
[SOLVED] Quick ?: Where is the doc. for the WITH command? May the 4th be WITH you...
Anyone know where to find documentation on the WITH command?

Example use case:
DEFINE FILE CAR
COUNTER/I3 WITH COUNTRY = COUNTER + 1;
END


Thanks in advance!

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


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
May 04, 2016, 03:48 PM
GavinL
I usually refer back to 8.1.04 DS Help file since it's faster to search and it's an actual help file, but the only WITH it refers to is "WITH CHILDREN"

TABLE FILE filename{PRINT|SUM} ...
FOR hierarchyfld 
parentvalue {GET|WITH} CHILD[REN] [n|ALL]
 [AS CAPTION|'text'] [LABEL label]




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 03:56 PM
Tom Flynn
Sorry about the font, I'll clean it up if needed...
I searched with this syntax: using a virtual field

8.1.05 Documentation

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 04, 2016, 04:01 PM
GavinL
I think you found all the documentation on it. :P



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 04:04 PM
Tom Flynn
Yep, probably! LOL


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 04, 2016, 04:06 PM
GavinL
I found this under Virtual Fields Attributes, but no example code or definitions of it's use.

Miscellaneous
WITH
If no columns from the synonym are used in the expression or have been defined, you can use the WITH option to identify the logical home of the defined calculation. You can also use the WITH option to move the logical home for the virtual column to a lower segment than it would otherwise be assigned (for example, to count instances in a lower segment).

Note: This attribute only appears for DEFINE and FILTER custom fields.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 04:09 PM
GavinL
EEEWWWWW... Look what I just found.. Found it under "virtual field for OCCURS"

DEFINE FILE EMPLOYEE
  CTR/I5 WITH DED_AMT = IF EMP_ID NE LAST EMP_ID THEN 1 ELSE LAST CTR + 1;
END
TABLE FILE EMPLOYEE
  SUM CNT.DED_AMT NOPRINT EMP_ID LAST_NAME FIRST_NAME CURR_SAL
  COMPUTE DEDLEN/I5 = 12 * CNT.DED_AMT;
  BY EMP_ID NOPRINT
  SUM DED_AMT
  BY EMP_ID NOPRINT
  ACROSS CTR NOPRINT
  WHERE DED_CODE EQ 'FICA'
  ON TABLE SET HOLDLIST PRINTONLY
  ON TABLE HOLD AS OCCURS1 FORMAT ALPHA
END




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 04:19 PM
CoolGuy
Tom and Gavin,

You guys are the best! lol Near impossible to find anything on this guy.

So it's a way to build in a virtual field assigning it a segment if no real field is used therein. I can create counters, etc. with this bad boy.

That example is quite interesting. Why stick the CTR value in an invisible ACROSS? What is that DEFINE doing? haha

If this record's employee ID is not the same as the last record's employee ID, then set CTR to 1, else set it to whatever the value of CTR was last and add 1... ???? Why? Oh! So, it's resetting the counter every time an employee ID changes. Der!

Haven't worked with that employee sample data much myself. So, in essence, its showing the ded_amt rolled up for every employee by ID across...whaaah???

Thanks for finding what you did guys! Appreciate it!

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


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
May 04, 2016, 04:29 PM
GavinL
Also funny, it was an example for WITH, but wasn't really about WITH, they just happen to use it in that example. Smiler Welcome to IBI Documentation.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 04:36 PM
jcannavo
No wonder why sometimes users forego the documentation for the smarts on this forum Smiler


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
May 04, 2016, 04:39 PM
GavinL
Also found a small phrase and example here, but not much more than you already found:

DEFINE FILE GGSALES
NCOUNT/I5 WITH UNITS = NCOUNT+1;
END


http://infocenter.informationb...20%57%49%54%48%22%20



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 04:39 PM
CoolGuy
Sheesh....

So, they are hiding the sum of the count of how many deduction amounts there are for each employee by ID, while denoting them by such with their last name, first name, and current salary, while also throwing in some fandangled computed length of deduction amt time period of some sort. Then, showcasing each of those amounts for each employee across the number of deductions there were for each of them.

So, in conclusion, you can build a counter for a given segment's measure(s) to do some pivot voodoo if desired.... Hmmm...

Again, SHEESH!! lol


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
May 04, 2016, 04:41 PM
CoolGuy
Thanks Gavin for all the finds!

The docs really need some TLC... Search is horrible too.


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
May 04, 2016, 04:47 PM
GavinL
I'll see if this works.. It's a snapshot of the help file in 8.1.04..





- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 05:00 PM
CoolGuy
Trippy stuff! Again, thanks for sharing!


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.