zenwalk / arcmapbook

Automatically exported from code.google.com/p/arcmapbook
Other
0 stars 0 forks source link

Select by Scale causes a Type Mismatch Error #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Mapbook which has the scale set in an index layer field.
2. In the Mapbook TOC, right click on Series and select Select/Enable
Pages, and Unselect all.
3. In the Mapbook TOC, right click on Series and select Select by Scale. 
Enter "=" and a numeric value for the scale.

What is the expected output? 
Selection according to the scale entered.

What do you see instead?
"DSMapBookUIPRj - SelectbyScale - Type Mismatch."

What version of the product are you using? On what operating system?
Version for 9.2 (most files dated 24/06/2008)on Windows XP

Please provide any additional information below.

Original issue reported on code.google.com by janet.j....@gmail.com on 2 Nov 2008 at 6:13

GoogleCodeExporter commented 9 years ago
Hi Janet, I can confirm this bug. Thanks for taking the time to report it, and 
with 
clear steps to reproduce. I don't have a workaround at this time.

Original comment by map...@gmail.com on 6 Nov 2008 at 6:46

GoogleCodeExporter commented 9 years ago

Original comment by map...@gmail.com on 29 Jan 2009 at 9:30

GoogleCodeExporter commented 9 years ago
I have a fix for this problem.  Do I just post it here?

Original comment by janet.j....@gmail.com on 13 Feb 2009 at 2:05

GoogleCodeExporter commented 9 years ago
Yes please! If it's large you can email it to me, maphew@gmail.com

Original comment by map...@gmail.com on 18 Feb 2009 at 7:41

GoogleCodeExporter commented 9 years ago
The problem arises in `DSMapBookUIPrj` in the code for `frmSelectPages`

Line 97 sets a String variable, `sExp to CStr(dScale) & " " & cmbScale.Text & " 
" &
txtScale.Text` , so we have, as an example “2000 = 10000”. Line 98 then 
attempts to
evaluate this statement :
{{{
   If sExp Then
}}}
and of course it fails, because the string expression cannot be evaluated as 
such.
Unfortunately VB6 has no Evaluate or EVAL statement which could be used to 
rectify
the problem.  So there are two ways to do this:

1.     Do a CASE statement on the operator eg:
{{{
   SELECT CASE cmbScale.Text
      CASE “=”
         IF dScale = CInt(txtScale.text) then
            pPage.EnablePage = True
            pNode.Image = 5
         END IF
      CASE “<”
         IF dScale < CInt(txtScale.text) then
            pPage.EnablePage = True
            pNode.Image = 5
         END IF
}}}
etc etc

2.    Bring in the ability to do an eval statement by adding the Microsoft 
Script
Control 1.0 ((msscript.ocx) as a Reference in the project. I already had it 
listed in
VB6 in Project->References and just had to check it on.  There is information 
on the
Microsoft Downloads Page about how to get it, but I imagine you will already 
have it
somewhere in your system.

The code is then simply:
{{{
   96:     dScale = m_pMapSeries.Page(lLoop).PageScale
   97:     sExp = ScriptControl1.Eval(CStr(dScale) & " " & cmbScale.Text & " " &
txtScale.Text
   98:     If sExp Then
}}}
with only line 97 changing.  This is the way I did it, and it works perfectly.

I must be the only person using this, as I could find no other complaints about 
the
problem.  I currently have 475 maps to print, and need to change a couple of 
items on
some of the maps with a bigger scale before they are printed, consequently this 
has
really been of great use to me.

If any of this doesn’t make sense, let me know and I will be happy to 
elucidate.

Regards,

Janet

Original comment by map...@gmail.com on 3 Mar 2009 at 6:32