Hi Heather
Thanks for reaching out. I'll add
@Kalu Ribush to this discussion as I might need his insight on this too.
My initial idea was to use the query that Kalu creates for each site that his tool creates a map for. Unfortunately, that query name seems to be variable depending on the table name and maybe even also depending on the column with the unique values.
Kalu, in your code I can see you use this statement to set the name of the query for each site:
strThisSite = "q_"+str$(left$(strColumnValueFileNameFix,24)) strThisSite = "q_"+str$(left$(strColumnValueFileNameFix,24))
strColumnValueFileNameFix
seems to originate from this expression:
aliasColumnValueFileName = strSiteTab+"."+arrayColumnsNamesUnique(intSelectedColumnFileName)
Can you see a problem in changing this to a fixes query name, say q_CurrentSite:
strThisSite = "q_CurrentSite"
If we could modify your tool in this way, we could use, or maybe even include my small utility in your tool, that could read values from whatever column the user wants to, using a SmartText like this:
$mb{ReadValue("q_CurrentSite", "Borough", 1, 0)
.
I can give this a try if you think it would be possible, Kalu.
------------------------------
Peter Horsbøll Møller
Distinguished Engineer
Pitney Bowes Software & Data
------------------------------
Original Message:
Sent: 02-19-2020 00:24
From: Heather Holder
Subject: Smart text in Layout Automation
Dear Peter,
Similar to what David Cini is trying to undertake, I am trying to produce a land register. This is a register of just over 900 land parcels. i have been tasked with producing an A4 page per land parcel which shows a map of the land parcel and provides attribute data about the lad parcel. I have found Kalu Ribush's SiteMapper tool which is perfect for automating the production of a large number of maps and have got this tool working, it is very simple and easy to use.
Kalu's SiteMapper tool is designed to allow for the return of attribute data for one column. At this stage I have 12 columns (maybe more) of attribute data I would like to display on the page. Kalu did not design his tool to return multiple fields of attribute data (this is not a criticism)
I am trying to find a way to put the attribute data for each land parcel on the layout page and still utilise SiteMapper to automate the production of over 900 maps.
I have investigated the use of David Cini's smart text code
$mb{ColumnInfo(LayerInfo(LayoutItemWinID(CurContext(1), "Map-1", 1),1,1),"COL3",1)}
and it provides the column name from the selection in the layout window called (Map-1) but not the associated attribute data value.
I am not very good with MapBasic language so am wondering of you or someone/anyone can assist to create a smart text code to return attribute data. I'm thinking/hoping that for each attribute required there would be an individual smart code text. Much like David Cini's above it wold require the change of COL3 to COL4 etc to return the correct value but referring back to the layout map (Map-1) so tat when the SiteMapper tool is run it will change the value based on the land parcel being referred to in the layout map (Map-1).
I have also investigated your recommendation to utilise the GetColumnValue tool and use the smart text script
$mb{ReadValue("Selection", "Borough", 1, 0)
as you have provided above. Where "Selection" is the name of my land register table and "Borough" is the name of the column and a specified row number. However when running the SiteMapper tool this value remains the same - unless I have missed something - which is highly likely
For some reason it won't let me insert a screen shot or attach a file, so hopefully this make sense. Happy to chat if it doesn't my direct line in 07 4761 3604
I suppose I am loving the potential of using smart text codes to generate the attribute data because then you can customise the layout window with smart text codes as opposed to adjusting Kalu's SiteMapper tool to allow for X number of columns. My Land Register project currently has 12 columns of attribute data I wish to show, however I see application for other Council Registers which at this stage have an unknown number of columns.
Any help would be very gratefully received.
Heather Holder
------------------------------
Heather Holder
GIS Technical Assistant
Whitsunday Regional Council
Proserpine
Original Message:
Sent: 01-14-2020 03:20
From: Peter Horsbøll Møller
Subject: Smart text in Layout Automation
Hi David
Here's a small utility that can be used to read values from a specific record in a specific table.
The tool has a function called MSFuncGetColumnValue which is registered as a public MapBasic function under the name ReadValue. This means that you can use this function from inside MapInfo Pro, for example in a SmartText.
You will need MapInfo Pro 17.0.3 or newer to take advantage of this tool.
Here's the declaration of the function:
Declare Function MSFUNCGetColumnValue( ByVal sTab As String
, ByVal sCol As String
, ByVal nRowID As Integer
, ByVal bReturnError As Logical ) As String
It takes these parameters:
- The table to read the value from
- The column to read the value from
- The RowID to read the value from
- Should it show potential errors or just return an empty string
Here is an example of how to use it. If you want to create a SmartText the can return values from the current selection, you can create one like this: $mb{ReadValue("Selection", "Borough", 1, 0)
.
In the example below, you can see how this would look in the layout. Also notice that I have used MapInfo Pro v2019 to create the example below which explains why I can use FALSE instead of 0.
If you exit the edit mode of the text and if you have a current selection, the SmartText will display the value from the borough column. Note that the value will automatically change if you select a different record.
You can, of course, make the SmartText read from a fixed table instead of the current selection.
I have attached the compiled application as well as the source code for this small utility.
------------------------------
Peter Horsbøll Møller
Distinguished Engineer
Pitney Bowes Software & Data
Original Message:
Sent: 01-07-2020 18:21
From: David Cini
Subject: Smart text in Layout Automation
Hey Mapinfo Community
I am new to Mapinfo and am hoping to automate the text details in a title of a layout.
My goal is to display the attribute information of column of a tab.
A bit of background. The purpose is, we are seeking the row information in a column within a table. We are working on property boundaries with Lot and Plan information.
So the process is; we select the single lot as a selection and create a layer from the selection. The good thing about this is it will return a single row of attributes in a table historically titled "Query1". We want to use a column within the table "Query1" named - Lot_Plan and grab the only attribute as the title of the figure by creating a smart text script to call the information of attribute in a table.
The title we want with a smart text line is something like 234SP12345678 (an example of the information within the column Lot_plan)
So far we have a script that reads
$mb{ColumnInfo(LayerInfo(LayoutItemWinID(CurContext(1), "Map-1", 1),1,1),"COL3",1)}
--This script only returns the name of the column and not the attribute data in the row.
If someone can offer assistance on the correct script.
Further to this and more challenging would be how we could call the attribute data from multiple columns which would create an automated title such as "Lot 234 on plan 12345678 with a lot area of 245m2 (in this example the bold numbers are the attributes taken from a table.)
------------------------------
David Cini
Knowledge Community Shared Account
------------------------------