1 / 12

McGyver for Dynamic Subtotals/Subfoots

McGyver for Dynamic Subtotals/Subfoots. Presented by David Smith of Brinker International. Biography. David Smith Focus/WebFocus since 1985 VMX, Opcom, Octel, Lucent, Avaya, Verizon, Brinker GL, AR, AP, Payroll, HR, Sales, Mfg, Eng, BI

vern
Download Presentation

McGyver for Dynamic Subtotals/Subfoots

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. McGyver for Dynamic Subtotals/Subfoots Presented by David Smith of Brinker International

  2. Biography • David Smith • Focus/WebFocus since 1985 • VMX, Opcom, Octel, Lucent, Avaya, Verizon, Brinker • GL, AR, AP, Payroll, HR, Sales, Mfg, Eng, BI • Brinker International - Chilis, Maggianos, Macaroni Grill, On the Border • 7.6.11 • RPM (Restaurant Performance System) • MRE, Report Caster, Info Assist • Teradata, MS SQL • HTML, PDF, EXCEL, ACTIVE, FLEX McGyver - David Smith

  3. Business Requirement • Our business group needs a purchase report that: • Lists detail values (date, extend cost, qty, etc) grouped by region, vendor, and product type • At each change in vendor, display on one line beneath the detail the total sales tax for all purchases from the vendor for the period selected as free text. • Under the sales tax subtotal line, display a subtotal of the extended cost for each product type purchased from the vendor for the period selected as free text. The number of lines is dynamic and could range from 1 to 100 based on the product types purchased during the period selected. • On one line, under the product type subtotals, display the Total Extended cost for the Vendor for all detail lines as free text. • HTML, PDF, Excel formats • Must be efficient. McGyver - David Smith

  4. Dynamic Subtotals Business Mockup McGyver - David Smith

  5. Problem: • Grouping dynamic ranges of subtotals/subfoots together either at the end of a sort break or end of the report (or even at the top) is not possible using standard WebFocus syntax. McGyver - David Smith

  6. Possible Solutions • Multi-Verb ? • No Way • Join/Match ? • Hard coded subfoot/subtotal values. Needs to be dynamic • Repeat/Loops w/-Includes ? • Too many pre-holds for every sort break • Loop at subhead to –INCLUDE hold file hit wall at 84 loops • McGyver ? • Success! McGyver - David Smith

  7. Solution Report McGyver - David Smith

  8. McGyver Setup -* Set up McGyver master and data file. -* -* Build McGyver MFD FILEDEF MCMAS DISK MCGYV.MAS -RUN -WRITE MCMAS FILENAME=mcgyv, SUFFIX=FIX , $ -WRITE MCMAS SEGMENT=ONE, SEGTYPE=S0, $ -WRITE MCMAS FIELDNAME=CONTROL, USAGE=A1, ACTUAL=A1, $ -WRITE MCMAS SEGMENT=TWO, SEGTYPE=S0, PARENT=ONE, OCCURS=VARIABLE, $ -WRITE MCMAS FIELDNAME=CHAR1, USAGE=A1, ACTUAL=A1, $ -WRITE MCMAS FIELDNAME=CTR, ALIAS=ORDER, USAGE=I4, ACTUAL=I4, $ -* -* Build McGyver FTM FILEDEF MCGYV DISK MCGYV.FTM -RUN -* Control=X: used as Join cross reference target field -* CHAR1=A, CTR=1: display detail -* CHAR1=B, CTR=2: display dynamic subtotals/subfoots -WRITE MCGYV XAB McGyver - David Smith

  9. Join/Define/Set JOIN CONTROL WITH BODYTYPE IN CAR TO UNIQUE CONTROL IN MCGYV AS J2 -* CTR=1 display detail, CTR=2 display subtotals/subfoots. DEFINE FILE CAR CONTROL /A1 WITH BODYTYPE='X'; SUM_CAR /A40 =IF CTR EQ 2 THEN ' ' ELSE CAR; SUM_BY_MODEL /A30 =IF CTR EQ 2 THEN ' ' ELSE MODEL; SUM_SALES_DTL/A15 =IF CTR EQ 2 THEN ' ' ELSE PTOA(SALES,'(P12.2CM)','A15'); SUM_DCOST_DTL/A15 =IF CTR EQ 2 THEN ' ' ELSE PTOA(DEALER_COST,'(P12.2CM)','A15'); BY_CTYCAR /A35 =IF CTR EQ 2 THEN CAR ELSE COUNTRY; SF_SALES /P12.2CM=SALES; SF_DCOST /P12.2CM=DEALER_COST; END -* WebFocus 7.6.11. Remove blank lines above subfoots/subheads. SET DROPBLNKLINE=ON McGyver - David Smith

  10. Table TABLE FILE CAR SUM SUM_CAR AS 'Car' SUM_BY_MODEL AS 'Model' SUM_SALES_DTL AS 'Sales' SUM_DCOST_DTL AS 'Cost' BY COUNTRY NOPRINT BY CTR NOPRINT BY BY_CTYCAR NOPRINT BY SUM_BY_MODEL NOPRINT ON COUNTRY SUBHEAD "</1 Country: <COUNTRY" ON CTR SUBFOOT "Total Dealer Cost: <ST.SF_DCOST" WHEN CTR EQ 1 ON BY_CTYCAR SUBFOOT "Subtotal Sales for <CAR :<ST.SF_SALES" WHEN CTR EQ 2 ON CTR SUBFOOT "Total sales for <COUNTRY :<ST.SF_SALES" WHEN CTR EQ 2 McGyver - David Smith

  11. Table continued WHERE COUNTRY EQ 'ITALY' HEADING "McGyver Technique with Dynamic Subtotals/SubFoots" ON TABLE NOTOTAL ON TABLE SET PAGE NOLEAD ON TABLE SET HTMLCSS OFF ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * GRID=ON,BORDER=OFF,SQUEEZE=ON,SIZE=8,$ TYPE=HEADING,JUSTIFY=CENTER,$ TYPE=TITLE,JUSTIFY=CENTER,$ TYPE=DATA,COLUMN=SUM_SALES_DTL,JUSTIFY=RIGHT,WHEN=CTR EQ 1,$ TYPE=DATA,COLUMN=SUM_DCOST_DTL,JUSTIFY=RIGHT,WHEN=CTR EQ 1,$ -* Pre 7.6.11. Only for PDF/HTML. Uncomment next line and turn HTMLCSS ON. Not perfect. -*TYPE=DATA,SIZE=1,WHEN=CTR EQ 2,$ ENDSTYLE END McGyver - David Smith

  12. Reference User Forum Presentation / 2010-12-16: McGyver Technique http://www.informationbuilders.com/support/developers/presentations?id=388 Tips & Techniques / McGyver Technique Introduction http://techsupport.informationbuilders.com/bestpractices/macgyver/cof_tcn_m00.html Tips & Techniques / McGyver Techniques http://techsupport.informationbuilders.com/bestpractices/macgyver/toc.html Tips & Techniques / McGyver Dynamic Subtotals/SubFootshttp://www.informationbuilders.com/support/developers/McGyverDynamic Contact David Smith: david.smith@brinker.com , dnoelsmith@gmail.com McGyver - David Smith

More Related