Export to URL Hack - AppGeo/GPV GitHub Wiki
It sometimes comes in very handy to be able to generate a "clean" GPV url with a large number of selectionids. Occasionally I'll get a request for a selection of all parcels in town that meet a certain criteria, for which I will use a filter to generate that list; however, if I want to share that list as a GPV selection set that displays efficiently, it's usually best to take that list of selectionids & generate a clean GPV url to share with others. In order to accomplish this, I've set up an alternative Export Stored Procedure for my parcel layer. When I need to use it, I rename my normal parcel export stored procedure & replace it with the alternate one.
Here's my normal Parcel Export Stored Procedure:
CREATE PROCEDURE GPV.GPVExport_Parcel
@idlist text
AS
select
RTRIM(a.PIN) as Parcel_ID,
RTRIM(a.Location) as Parcel_Address,
RTRIM(a.Owner_name) as Owner1,
RTRIM(a.Co_Owner_name) as Owner2,
RTRIM(a.ownerAddress) as Address,
RTRIM(a.ownercity) + ', ' + RTRIM(a.ownerstate) + ' ' + RTRIM(a.ownerzip) as CityStZip,
case WHEN (a.APR = '3930') THEN 'APR' ELSE RTRIM(a.LandUse) END as [Land Use],
cast(cast(a.Acres as money) as varchar) as Acres
from gisadmin.TOA_CAMA_TABLE a
inner join iter_charlist_to_table(@idlist, DEFAULT) b on a.pin = b.nstr
where a.LANDUSE != 'CONDO MAIN'
order by a.Street, a.Number_, a.Owner_Name
GO
Here's my hack, the alternate export procedure, which generates a URL instead of a spreadsheet:
CREATE PROCEDURE GPV.GPVExport_Parcel_URL
@idlist text
AS
declare @list varchar(6000)
set @list = ''
SELECT @list = @list + ',' + a.PIN
from gisadmin.TOA_CAMA_TABLE a
inner join iter_charlist_to_table(@idlist, DEFAULT) b on a.pin = b.nstr
where a.LANDUSE != 'CONDO MAIN'
set @list = right( @list , len( @list ) -1 )
set @list = 'http://gis.amherstma.gov/public/viewer.aspx?application=parcelapp&targetids=' + @list
select @list
GO