Hello,
I am having a hard time with filters on Web Application reports and hope that someone can help me out.
I have an DBF File (machine) containing a list of equipment. The first field in the DBF file is a unique ID field, called NUMBER. It is a C,20 field.
I am trying to print a report called Equip Simple Web. The report works fine when no filter is applied.
The filter should a user allow to select a range, first ID and last ID number for which the report should be printed.
In the Web Component, Control section I have created two Dropdown Boxes for FirstN and LastN. Both are defined a Character variables. See attached JPG picture for this screen.
In the �After Validate� Properties, I have entered the code below. Note that I have tried many different versions to build the filter without success. Often I wrote the result from a filter attempt as a comment afterwards.
What is the correct syntax for the filter?
dim Filter as c
dim order as c
'dim FirstN as C
'dim LastN as C
'TRYING TO FIND OUT HOW TO BUILD THE FILTER SO THAT IT WORKS
'-----------------------------------------------------------
'Filter = "" 'No Filter - Default, works and prints report
'Filter = "NUMBER >=VAR->FirstN" 'Prints Report, but does not apply the Filter
'Filter = "NUMBER >=FirstN" 'Prints Report, but does not apply the Filter
'Filter = NUMBER >= FirstN
'Filter = "NUMBER >=Trim(VAR->FirstN)" 'Prints Report, but does not apply the Filter
'Filter = "MACHINE->NUMBER >=FirstN" 'Does not print Report, no error shown.
'Filter = MACHINE->NUMBER >=FirstN 'Gives error "Field is not Recognized". Does not print Report
Filter >= Trim(FirstN) '
'Filter = NUMBER >=Trim(FirstN) 'Gives an Error that Variable FirstN is not found. Does not print report.
'Filter = NUMBER >=Trim(VAR->FirstN) 'Also gives and Error that Variable FirstN is not found and does not print report)
'Filter = "NUMBER >=300" '?
'filter = Number >= stritran(alltrim(FirstN), crlf()," .or. ") 'Copied from Web Demo Application. does not print the report, no error.
'filter = alltrim(FirstN) 'Does not print report, no error shown.
'------------------------------------------------------------
Order = "NUMBER"
Dim filename as c
filename = session.session_folder + chr(92) + "tempreport.pdf"
filename = report.saveas("Equip Simple WEB@[PathAlias.ADB_Path]\machine.dbf","pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
I am having a hard time with filters on Web Application reports and hope that someone can help me out.
I have an DBF File (machine) containing a list of equipment. The first field in the DBF file is a unique ID field, called NUMBER. It is a C,20 field.
I am trying to print a report called Equip Simple Web. The report works fine when no filter is applied.
The filter should a user allow to select a range, first ID and last ID number for which the report should be printed.
In the Web Component, Control section I have created two Dropdown Boxes for FirstN and LastN. Both are defined a Character variables. See attached JPG picture for this screen.
In the �After Validate� Properties, I have entered the code below. Note that I have tried many different versions to build the filter without success. Often I wrote the result from a filter attempt as a comment afterwards.
What is the correct syntax for the filter?
dim Filter as c
dim order as c
'dim FirstN as C
'dim LastN as C
'TRYING TO FIND OUT HOW TO BUILD THE FILTER SO THAT IT WORKS
'-----------------------------------------------------------
'Filter = "" 'No Filter - Default, works and prints report
'Filter = "NUMBER >=VAR->FirstN" 'Prints Report, but does not apply the Filter
'Filter = "NUMBER >=FirstN" 'Prints Report, but does not apply the Filter
'Filter = NUMBER >= FirstN
'Filter = "NUMBER >=Trim(VAR->FirstN)" 'Prints Report, but does not apply the Filter
'Filter = "MACHINE->NUMBER >=FirstN" 'Does not print Report, no error shown.
'Filter = MACHINE->NUMBER >=FirstN 'Gives error "Field is not Recognized". Does not print Report
Filter >= Trim(FirstN) '
'Filter = NUMBER >=Trim(FirstN) 'Gives an Error that Variable FirstN is not found. Does not print report.
'Filter = NUMBER >=Trim(VAR->FirstN) 'Also gives and Error that Variable FirstN is not found and does not print report)
'Filter = "NUMBER >=300" '?
'filter = Number >= stritran(alltrim(FirstN), crlf()," .or. ") 'Copied from Web Demo Application. does not print the report, no error.
'filter = alltrim(FirstN) 'Does not print report, no error shown.
'------------------------------------------------------------
Order = "NUMBER"
Dim filename as c
filename = session.session_folder + chr(92) + "tempreport.pdf"
filename = report.saveas("Equip Simple WEB@[PathAlias.ADB_Path]\machine.dbf","pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
Comment