Tuesday, May 24, 2016

Macros and Scrolling Windows


I did a session on GP Macros today at the Amplify conference in Anaheim. Questions came up regarding scrolling windows that I did not have time to cover in the short 1-hour session. I'm posting this example as an aid to understanding how scrolling windows work. The macro language will only deal with the number of rows that are visible in the scrolling window. When you open the SOP Entry window there are 8 lines visible in the scrolling window. When you add information to the scrolling window you need to include the command ScrollByLine down scrollwin 'Line_Scroll' at the bottom of the 8th line. Every line after line 8 is still considered line 8 because there are still only 8 lines visible. Below is a partial example macro of what it looks like to add more than 8 items to the SOP Entry scrolling window:

CheckActiveWin dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry'
  ClickHit field 'SOP Type' item 4  # 'Invoice'
  MoveTo field 'Document ID'
  MoveTo field 'SOP Number'
  MoveTo field 'Customer Number'
  TypeTo field 'Customer Number' , 'AARONFIT0001'
  MoveTo field 'Customer Name'
  MoveTo field 'Primary Shipto Address Code'
  MoveTo field 'Document Date'
  MoveTo field 'Batch Number'
  TypeTo field 'Batch Number' , 'AUG31'
  MoveTo field 'Location Code'
  MoveTo field 'Customer PO Number'
  MoveTo field 'Currency ID'
  TransLinePrepare scrollwin 'Line_Scroll'

  MoveTo line 1 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 1 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 1 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 1 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 1 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
#
  MoveTo line 2 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 2 scrollwin 'Line_Scroll' field 'Item Number' , '1-A3261A'
  MoveTo line 2 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 2 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 2 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
#
  MoveTo line 3 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 3 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 3 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 3 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 3 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
#
  MoveTo line 4 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 4 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 4 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 4 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 4 scrollwin 'Line_Scroll' field '(L) Extended Price'
#
  TransLinePrepare scrollwin 'Line_Scroll'
  MoveTo line 5 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 5 scrollwin 'Line_Scroll' field 'Item Number' , '1-A3261A'
  MoveTo line 5 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 5 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 5 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
#
  MoveTo line 6 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 6 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 6 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 6 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 6 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
#
  MoveTo line 7 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 7 scrollwin 'Line_Scroll' field 'Item Number' , '1-A3261A'
  MoveTo line 7 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 7 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 7 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '1-A3261A'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '1-A3261A'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '1-A3261A'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'  
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
  TypeTo line 8 scrollwin 'Line_Scroll' field 'Item Number' , '128 SDRAM'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Dropship'  # 'FALSE'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Unit Price'
  MoveTo line 8 scrollwin 'Line_Scroll' field '(L) Extended Price'
  TransLinePrepare scrollwin 'Line_Scroll'
  ScrollByLine down scrollwin 'Line_Scroll'
#
  MoveTo line 8 scrollwin 'Line_Scroll' field 'Item Number'
etc., etc., etc.,

I hope this helps someone struggling with scrolling windows.
Kind regards,
Leslie



2 comments:

Anonymous said...

Hello. I attended your session and found it very informative. Question...is the Advanced Macro Menu available in GP 2013 R2? I can't find it so thinking it was added in GP 2015 or 2016. Thanks.

Dynamics Confessor said...

Hi,
Thank you for attending the session. I am very glad you picked up some tips. The Advanced Macro Menu is indeed available in GP 2013 R2 (and many versions earlier). In order to reveal the Advanced Macro Menu, you must edit your Dex.ini file. Add the switch ShowAdvancedMacroMenu=TRUE to your Dex.ini file. Without that line in your Dex.ini file, you will not be able to see the menu. Once you add it, the 'Advanced' menu will be located at the bottom of the Macro menu.
Kind regards,
Leslie