I am working on the early stages of a report preview button that uses an array to pop up a list of members by State, City, or Zip,the report will be filtered accordingly. The form is based upon a table called "tblMembers". So far, the State portion of the script works as designed. In fact, the city portion also works as designed with the exception of one annoying problem.
The portion of the script giving me a problem is the following line:
City(i)= alltrim(tbl.city)+ " " + alltrim(tbl.state)
For the life of me, I cannot figure out why placing a SPACE between the city and state fields results in the array coming up blank. If I eliminate the space in the line above, both fields are properly displayed in the array.
Please Note: using a space in the state option works perfectly as follows:
STATE(i)= alltrim(Ltbl.STATE) + " " + alltrim(Ltbl.Abbreviation)
I'm sure there is something obvious I did wrong, but I cannot see my own mistake. The only difference that stands out to me so far, is the use of a LookUp Table for the State option while the City option uses table.current()
Here is the portion of the script for the City option.
'------------------------------------------
case alltrim(Selection) = "City"
'Make City the current index
'This index sorts tblMembers by alltrim(City) + " " + alltrim(State)
'Allow the User to Preview/Print a Report Filtered by City
Dim Choice as C
Dim Shared ChoiceCity as C
Dim Nrecs as N
Dim i as N
Dim City(3000) as C 'Use a variable instead of 3000 later
tbl = table.current()
tbl.index_primary_put("City")
Nrecs = tbl.records_get()
i=1
tbl.fetch_first()
while .not. tbl.fetch_eof()
City(i)= alltrim(tbl.city)+ " " + alltrim(tbl.state)
tbl.fetch_next()
i=i+1
end while
Choice =ui_get_list_array("Select One City",1,"CITY")
ChoiceCity = Word(Choice,1)
debug(0)
Dim query.description as C
Dim query.filter as c
Dim query.options as c
Dim query.order as c
query.description = "Preview Rpt. by CITY"
query.order = ""
query.filter = "city = ChoiceCity"
query.options = ""
tbl.query_create()
:report.preview("rptMembers")
'--------------------------------------------
The portion of the script giving me a problem is the following line:
City(i)= alltrim(tbl.city)+ " " + alltrim(tbl.state)
For the life of me, I cannot figure out why placing a SPACE between the city and state fields results in the array coming up blank. If I eliminate the space in the line above, both fields are properly displayed in the array.
Please Note: using a space in the state option works perfectly as follows:
STATE(i)= alltrim(Ltbl.STATE) + " " + alltrim(Ltbl.Abbreviation)
I'm sure there is something obvious I did wrong, but I cannot see my own mistake. The only difference that stands out to me so far, is the use of a LookUp Table for the State option while the City option uses table.current()
Here is the portion of the script for the City option.
'------------------------------------------
case alltrim(Selection) = "City"
'Make City the current index
'This index sorts tblMembers by alltrim(City) + " " + alltrim(State)
'Allow the User to Preview/Print a Report Filtered by City
Dim Choice as C
Dim Shared ChoiceCity as C
Dim Nrecs as N
Dim i as N
Dim City(3000) as C 'Use a variable instead of 3000 later
tbl = table.current()
tbl.index_primary_put("City")
Nrecs = tbl.records_get()
i=1
tbl.fetch_first()
while .not. tbl.fetch_eof()
City(i)= alltrim(tbl.city)+ " " + alltrim(tbl.state)
tbl.fetch_next()
i=i+1
end while
Choice =ui_get_list_array("Select One City",1,"CITY")
ChoiceCity = Word(Choice,1)
debug(0)
Dim query.description as C
Dim query.filter as c
Dim query.options as c
Dim query.order as c
query.description = "Preview Rpt. by CITY"
query.order = ""
query.filter = "city = ChoiceCity"
query.options = ""
tbl.query_create()
:report.preview("rptMembers")
'--------------------------------------------
Comment