9/19/2016

Selectively Hiding the Social Security Number on Contact Screen (ZPSQL)

A customer just asked if there was a way to selectively hide the Social Security number field on the Contact File Screen so that only certain users could see it. The most reasonable way to do this would be by Security Access Level. The script below hides both the number field and its label if the user's security level is over 2. This script was created using "Contact File" for the Module, "Contact" for the Screen, and "Screen" for the Action:

if zpsecure.cfs > 2
if wexist('propscreen')
cfscreen.zp_pageframe1.page2.txtSs_num.visible = .F.
cfscreen.zp_pageframe1.page2.lblSs_num.visible = .F.
else
cfscreen2.zp_pageframe1.page2.txtSs_num.visible = .F.
cfscreen2.zp_pageframe1.page2.lblSs_num.visible = .F.
endif
endif


You'll notice there appear to be two sets of screen references. This is because there are two Contact Screens: one launched from the Main Screen and one from the Property Screen.

It is worth noting you can also use the security setting to block printing of the field in any document by adding "zpsecure.cfs>2" to the Print When section in the approriate field properties via the Document Editor.

5/27/2016

Using Login Credentials to Fill Initial Fields (ZPSQL)

Because you have to login to use ZP SQL, the system knows who you are and can add your initials to a field automatically if desired. Your initials are stored in a system variable called ZPSECURE.OWNINIT. So if you want to always have your initials added to the Received By field in the Violations Screen each time you add a new violation record you can do so by creating a script for the "Add" action for the "Violations" screen:

replace comp_recv with zpsecure.owninit.

If you want to prevent anyone from editing that info once it is added automatically, just add another line to your script:

vlscreen.zp_pageframe1.page2.txtComp_recv.enabled = .F.

If you really want to lock down that info you should also create a script for the "Edit" action that repeats that second line of the script.


1/14/2016

Referencing Rental Status in Property Screen (ZP32)

If you need to run reports on permits or violations issued to rental properties it can be useful to have the Property database itself indicate that the property is used for rental. The following script is a one-time run script that would be executed from the Database Browser screen script option. It will put the value "RENTAL" in the Property User7 field if said property has any kind of Rental record store.

update property set user7 = "RENTAL" from rental where rental.prop_id = property.prop_id

Now you run reports from any screen and used the Advanced Filter option to check the Property User7 field for "RENTAL" to get only application records issued to rental properties.