4/28/2017

Changing the Default Sort in a Report Screen (ZPSQL & ZP32)

A customer asked if there was a way to change the default sort choice in their Violations Report Screen so that it always started on "Inspect Date." Looking at the sort choices in that screen I could see that that option was the fourth one in the list. To create the script in the User Defined Script Screen I chose "Zoning" as the Module, "ViiolateRep" as the Screen, and left "Screen" as the action. The actual script I entered was:

viorep.cmbsortby.listitemid = 4
viorep.sort_order = viorep.taglist(4,2)

Now when they enter that screen the default sort is the one they want. This script can be easily modified for other choices in the sorting list by changing the 4's in the script to the desired number. You can also use it for other report screens by substituting the proper screen name for "viorep".

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.

1/19/2015

Referecing Zoning District Setbacks From Any Screen (ZPSQL)

From the Property Screen you can easily reference the minimum setbacks defined for the assigned Zoning District by clicking on the "Zoning" label to display the Zoning District Maintenance Screen. This option may be even more useful on permit screens where you need to compare the desired setbacks of a project with those allowed. This script uses the Building Screen as an example but the script will work for almost any screen. I'm using the right-click option on the Script button but that is easily changed too. To implement the script start in User Defined Scripts Screen using "Building" as the Module, "Building" as the Screen and "Right" as the Action. Click the New button and then paste in the script below:

myAlias = alias()
 if not empty(property.zoning)
myCommand = [do zcodes_link in maintsql.app with '] + property.zoning +[']
&myCommand
endif

select (myAlias)

Now if you go to any Building Screen and right-click on the Script button the Zoning District Maintenance Screen will pop up showing the minimum setbacks allowed for that property.




10/03/2014

Changing the Default Date Range in a Report Screen (ZPSQL & ZP32)

A customer asked if it possible to change the default 30 day date range in a report screen. Using a script you can set the From date to any value you wish. Using the Rental Report Screen as an example the script would be:

rentrep.txtStartdate.value = DATE() - 60

Where the 60 value determines how many days back the range goes. This value is 30 by default but you can reset it using this script to any value you want. This approach should work for any report screen.


10/01/2014

Set A Default Date Type in Rental Reports Screen (ZPSQL & ZP32)

By default no date field is set when you enter the Rental Report Screen. You can use a script to change this. A customer just requested a way to make the Enter Date the default date field. To do this you start a new script in the User Defined Scripts Screen using "Housing" as the Module, "RentRep" as the Screen and "Screen" as the Action. The script itself would be:

rentrep.date_type="ent_date"
rentrep.cmbUsedate.value = "Enter Date"


Now when you first enter the Rental Report Screen the Enter Date will be shown as the default date type.