Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return user generated properties from all open forms

Forms & Screen

How to return user generated properties from all open forms

by  mdav2  Posted    (Edited  )
You may, for error logging purposes want to retrieve the values of all the user defined properties on all your forms. This is particulary useful in error logs as a memory dump will not show this information.

I would like to thank Weedz for telling me about the pemstatus function.


CODE
****

* This retrieves settings for all user generated form properties for all active forms
* The settings are stored in arrays that will be picked up by when a memeory dump is done

* Loop through all the (form) objects in the screens form collection
for each zoform in _screen.forms

* Each for will have a different array created, this will be the name of the screen
zcarrayname='z'+zoform.name

* Create an array that holds all the forms properties
= AMEMBERS(zgaproparray, zoform)

* Calculate the array size, by looping through the property array and only including those that are user generated propereties
znloop=0
for each zelement in zgaproparray

* Store the property name in single quotes
zcpropname="'"+zelement+"'"

* The pemstatus command checks the property on the form to see if its user generated
* It requires 3 parameters
* 1) The name of form
* 2) The name of the property enclosed in quotes
* 3) The user generated option (always 4)
* EG, pemstatus(testform,'nOrderNo',4)
if pemstatus(zoform,&zcpropname,4)=.t. then
* Increment the loop counter used to dimension the array with the forms properties and values
znloop=znloop+1
endif
next zelement

* Create an array that the values can be put into - this will be called the name of the form
Public &zcarrayname(znloop,2)

* Store the name and value in an array
znloop=1
for each zelement in zgaproparray

zcpropname="'"+zelement+"'"

if pemstatus(zoform,&zcpropname,4)=.t. then
&zcarrayname(znloop,1)=zelement
&zcarrayname(znloop,2)=zoform.&zelement
znloop=znloop+1
endif

next zelement

* Release all the variables used to create the arrays of form objects
release zgaproparray
release znloop
release zcarrayname
release zelement
release zoform
release zcpropname

next form
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top