Tip on quick way to find current form's class library in Sage Pro

Sage Pro uses Formsets for all its MDI forms. When debugging if you want to
find out which classlibrary your form belongs to here is what you can do:
- Ensure the form you want to know is the currently selected one.
- Press Ctrl+F9 (ensure you are running from VFP and have SBTDUTIL=ON).
- In the command window give
       MESSAGEBOX( _screen.ActiveForm.Parent.ClassLibrary)
- It will show the class library the form belongs to.

Further, if you are now interested in seeing when a property changes in that
formset you can give
PUBLIC lo_FormSet
Lo_FormSet = _screen.ActiveForm.Parent

Then in the watch window you can use lo_FormSet.so_FS.sc_Sono (or whatever
property you want to track)
Note: If you use the PUBLIC lo_FormSet, you will not be able to close the
formset w/o releasing the variable. To do this, in the command window give
Release lo_formset before you try to close the form.

Regards,
- Sankaran Raman
804-364-2995
sankaran@saharti.com
www.saharti.com
http://saharti.blogspot.com/

Tip for exiting Pro when you get Close open windows and cannot close

This will work only if you have SBTDUTIL=ON in Windows Environment and running Pro from within VFP

If you are trying to exit Pro and have no form open and Sage Pro still gives “Close Open windows”, press Ctrl+F9 to go the command window and give

go_cop.in_controlcount = 0
RESUME
and now you will be exit Pro.

Sage Pro set focus

Sage Pro sets focus in these following ways in the MDI forms:
1. State object sc_StatechangeSetFocus: This is the normal way by which Sage Pro changes focus when user moves from one "state" aka mode to another. In the design time form, hold your mouse over a state object and then press Ctrl+Shift and then click and VFP will select the state object. In the property sheet look for this property. You can set this to the "registry" name of another object in the form.

2. State object m_StateChangeSetFocus: This method is used instead of the property when the focus needs to be set conditionally.

3. In the FS object code. Search for m_SetFocus() and you most likely will find your code.

If you are interested in learning how to Program with Sage Pro you can buy our DVD. See www.saharti.com for details.

Simplify logging into Sage Pro when developing/debugging

You can use the KEYBOARD command to auto login into Sage Pro and
select an application.

Use the auto login only in a "development/debugging test environment"
as you will lose security.

Here is how (in Sage Pro 7.4:

- This is for auto login
Modify pro.prg and before line 4633 (that calls u_getus) give
** Auto login
KEYBOARD "ADMN{Enter}ADMN{Enter}"

- This is to choose an application at startup
Modify pro.prg and at line 5227 (2 lines after it displays
"Select initial application...." give
** Select Purchase orders
KEYBOARD "{ALT-F}OO"

The above two help you to go to the application w/o having to type
anything once you launch Sage Pro.

Sage Pro debugging during transaction rollback

When debugging Sage Pro during the save and that process is part of a
transaction and it throws a dialog, you cannot hit Ctrl+F9 to go to
the line causing the error. This is even if you have SBTDUTIL=ON.

There is a different windows environment variable that you can use
here. It is called TRANPOS.

In your Windows user settings if you add this variable and set it to
ON then it will break whenever the transaction gets an error. Use this
if you are debugging during transaction rollback

VFP 9 and ICASE

VFP 9 has a new useful function (especially for reports) named ICASE.
This helps where you had to do IIF(...(IIF...(IF now you can do it
using ICASE in a simpler way

Example (you can run it from command prompt):
Before:

FOR ln_count = 1 TO 4
DO CASE
CASE ln_count = 1
gc_cstmeth = "A"
CASE ln_count = 2
gc_cstmeth = "F"
CASE ln_count = 3
gc_cstmeth = "C"
CASE ln_count = 4
gc_cstmeth = " "
ENDCASE

? IIF(gc_cstmeth = "A", "Average", IIF(gc_cstmeth = "F", "FIFO",
IIF(gc_cstmeth = "L", "LIFO", "Not entered")))
NEXT

Now, using ICase
FOR ln_count = 1 TO 4
DO CASE
CASE ln_count = 1
gc_cstmeth = "A"
CASE ln_count = 2
gc_cstmeth = "F"
CASE ln_count = 3
gc_cstmeth = "C"
CASE ln_count = 4
gc_cstmeth = " "
ENDCASE

? ICASE(gc_cstmeth = "A", "Average", gc_cstmeth = "F", "FIFO",
gc_cstmeth = "L", "LIFO", "Not Entered")
NEXT

Tip on fixing issues with classes quickly (w/o having to quit Sage Pro)

This is a programmer's tip:
If you are trying to work on a screen in Sage Pro, it is painful to
- Find an issue in the screen- Quit Pro
- then modify the class- then login to Pro
- then load the screen

Here is a way out of the above:
First part of the trick:
- Load VFP in the Pro root folder. Create a program called ClearClass.prg
- In this program give 2 lines to clear the appropriate form class and FS
Examples:
If you are working with sopost
CLEAR CLASS Sopost
CLEAR CLASS cmpSopostFS
If you are working with sycust
CLEAR CLASS SycustMgr
CLEAR CLASS Sycust
CLEAR CLASS cmpSycustFS
If you have created a sub class, use Clear Class with those classes
- Give DO PRO
- Create a custom menu option, by
- Go to SM/System Installation
- Click Edit and goto "Custom" tab
- For menu Text give "CLEAR CLASS"
- For command line give "DO ClearClass.prg"
- If using VFP, click File/Login and login again (for the custom menu to get refreshed)
- If using SQL, Quit Pro and login again (for the custom menu to get refreshed)

Second part of the trick
- Is to load 2 instances of VFP
- In the previous instance you have Pro running.
- Load another instance of VFP and open your class in the class browser.
- Each time you find an issue in the screen you are working with, exit the screen in Pro (but do not quit Pro)
- Click on custom menu "Clear Class"
- In second instance, open the class, do your changes and click "Clean up class library" (to keep the class library file small and running fast)

Now you have the solution to avoid having to quit Pro to make changes to the class you are working with.

How to sum up values in data driller

The data driller does not provide for a Group By clause (it provides
for columns, where and order by)

But you can trick it to provide for a group By:
To do this, use the "Where" clause. Give a dummy where and then add
GROUP BY

Example for armast to group by sales person

In the Where clause give : custno = custno GROUP BY salesmn

Your SQL select would be

SELECT <fields you have chosen> ;
FROM <armast> ;
WHERE custno = custno GROUP BY salesmn ;
....
The custno = custno is to satisfy a valid where clause and then the group by.

P.S.: I haven't tried this myself recently, so you might have to tweak
it more than what I have mentioned here.

Store and bin maintenance improvements in Sage Pro ERP 7.4

In Sage Pro 7.4, there are three enhancements (that I can think of) to store/bin:

1. Ability to assign default store/bin per item location: One for receiving and one for shipping.

2. In IC Change setup information, there is an option to prevent use of empty store/bin when receiving (does not clean up past data but in future when entering a PO receipt or Item receipt or Work order completion, you cannot save with a blank store bin)

3. Privilege to allow creating store/bin on the fly. With this, you can prevent specific users from trying to create store/bins that are not there in the system.

ODBC issue with VFP 9

You cannot use ODBC with Visual FoxPro 9.0. Instead you have to use ADO (OLEDB). Unlike ODBC which gives a result set normally as a cursor, ADO gives the result set as an object (Dataset in .Net).

I tried this from within VFP (assuming a database named prodata and tables named syccomp, arcust99 in that database) and it worked.
Here is what I did:

oConn = CREATEOBJECT("ADODB.Connection")
oConn.ConnectionString = "provider=vfpoledb.1;;
data source=.\prodata.dbc"
oConn.Open
? oconn.Execute("Select * from syccomp")
lo =oconn.Execute("Select * from syccomp")
? lo.Fields[1].value
ln = 1

lo =oconn.Execute("Select * from arcust99", @ln)
? ln
? lo.Fields[1].value
? lo.Fields[0].value

You can use "DIM" to create the object in VB and use the Execute to get to the VFP data.

Do not use .F. or .T. as part of your item ID in Sage Pro ERP

If you have a .F. or a .T. as part of your item ID (like 10.F.Sheet), Sage Pro will allow you to save the item, but when you enter a SO and save the line using that item, it will give an error that no location is found. This will happen even if you have a valid location for that item.

This is caused because Sage Pro parses the value and change it to a 0 or a 1 and hence the item ID search does not work fine.

Tip to quickly add a menu to Sage Pro ERP 7.4

In Sage Pro ERP 7.4, the old menu system has been dropped for a new data driven menu.
Question now is how to add a new menu. To do this, you can use the tasklist and add it to the Master scheme. This will add it to the menu also. Problem is that Sage Pro, by default does not let you edit the Master scheme.

To allow for editing this add a Windows environment variable called "PROALLOWTASKLIST" and set it to "ON". Then load Sage Pro and you can right click on the Master scheme to add a new menu.

Intellisense for GO_SQL

How to get Intellisense for go_Sql in Pro

In the command prompt (after installing the pro tools) give
DO tools\sqltest

Then give
? go_sql. and you will get intellisense

For programs, give this

#IF 0
LOCAL go_Sql AS sbtmgrsql of sbtsql.vcx
LOCAL lo_t AS sbtcmpsql of sbtsql.vcx
#ENDIF

Now give
go_sql. to get intellisense for go_sql
lo_t. to get intellisense for lo_t and then change it to the table object.

You can also give LOCAL variables like
LOCAL lo_Arcust AS sbtcmpsql of sbtsql.vcx

lo_arcust = ThisFormSet.so_PI.m_GetRef("data.arcust")
lo_arcust. to get intellisense

In VFP 9, you can also give this in the WITH construct, like

WITH lo_Arcust AS sbtcmpsql OF sbtsql.vcx
ENDWITH

What table does Sage Pro 7.4 use to format ACH

The table name is "sydfrmd". This is used for both AP and PR (I think). You can modify this to suit the customer's bank's format.

Power tools for XP

http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

The above link allows you to get nice tools if you are using Windows XP.
The tools I like are:
1. Resizing Pictures (you can select multiple pictures in Windows Explorer,
Right Click, Choose "Resize Pictures", then choose what size you want and
they are resized (to new files, you can have them replace the original too).

2. Command Here: Allows you to load the command prompt from the folder you
are viewing in Windows Explorer.

Sage Pro 7.4 import enhancements

Just wanted to list all the Sage Pro ERP 7.4 (Pro 7.4) enhancements regarding importing (butverify since I am not sure what made the cut) :

  1. Pro 7.4 supports importing of Sales orders
  2. Pro 7.4 supports importing of Purchase orders
  3. All the standard imports now support allowing to map for all types(including Excel).
  4. You can save the mapping for re-use (will be useful if you importedfrom PeachTree once and mapped the fields, you can keep re-using thisagain)
  5. Pro 7.4 supports Excel importing of item pricing (and price groups).
  6. Other miscellaneous ones (check what's new for details)

P.S.: I have posted this as an answer in the loop

Message Master auto set print fax for statements

If you are using Sage Pro ERP message master and want statements to be either emailed or faxed based on which customer it is being sent to, you can do that. The "code" field in customer maintenance can be set to FAX, EMAIL. See code from that section below

DO CASE
CASE (lc_Work = "FAX" OR lc_Work = "FX" OR lc_Work == "F") AND .sl_Fax
lc_Return = "Fax "
CASE (lc_Work = "EMAIL" OR lc_Work = "EM" OR lc_Work == "E") AND .sl_Email

lc_Return = "Email"

Here, lc_Work can be code field in AR. In message master setup, you can even change the field