Hi all,
Ive been trying to use vfl one filter with four user input. If there has only one field, using generated code from program coding assistant, it works fine. but when im trying to add other field, it just read the first field and display the filter result based on the first field only not both. how can i achieve this
VLF One Filter
Re: VLF One Filter
Please ignore this if I misunderstood your question ..................
I am assuming that you have a working filter and you want to now add some new searchable fields to it by changing the code.
For example, if you had a working filter that does a customer Name search and you wanted to add a new type of search capability to it, say a customer City search, then the steps to do that would go broadly like this:
Alter the server module that searches the data base for Names to also be able to search for Cities.
You could do this two ways.
(1). Change the existing search SrvRoutine to accept the City as new additional input parameter (along with the existing Name parameter) and do a different type of search when it has been passed with a value in it.
(2). Or, add a completely new SrvRoutine that only does searches by City. The new routine would be just like the Name search routine, returning the exact same search result list, but it would have the City as an input parameter instead of the Name.
In either case you will need a new SELECT loop that searches by City instead of by Name.
How you do that depends on whether you have a logical view keyed by City and how many rows are typically in the table being searched.
To start you could just use SELECT WHERE(‘CITYCOLUMNNAME = #TheParameterCityName’) to get things working and then optimize the performance later.
Then in the filter put the customer City field onto the panel so that it can be input.
In the filter add logic so you can work out whether you need to do a Name search or City search.
Maybe use two search push buttons, or look at which of Name and City contains a value.
Then invoke the existing srvroutine for (1) with the additional City parameter, or invoke the new srvroutine in you used technique (2).
I am assuming that you have a working filter and you want to now add some new searchable fields to it by changing the code.
For example, if you had a working filter that does a customer Name search and you wanted to add a new type of search capability to it, say a customer City search, then the steps to do that would go broadly like this:
Alter the server module that searches the data base for Names to also be able to search for Cities.
You could do this two ways.
(1). Change the existing search SrvRoutine to accept the City as new additional input parameter (along with the existing Name parameter) and do a different type of search when it has been passed with a value in it.
(2). Or, add a completely new SrvRoutine that only does searches by City. The new routine would be just like the Name search routine, returning the exact same search result list, but it would have the City as an input parameter instead of the Name.
In either case you will need a new SELECT loop that searches by City instead of by Name.
How you do that depends on whether you have a logical view keyed by City and how many rows are typically in the table being searched.
To start you could just use SELECT WHERE(‘CITYCOLUMNNAME = #TheParameterCityName’) to get things working and then optimize the performance later.
Then in the filter put the customer City field onto the panel so that it can be input.
In the filter add logic so you can work out whether you need to do a Name search or City search.
Maybe use two search push buttons, or look at which of Name and City contains a value.
Then invoke the existing srvroutine for (1) with the additional City parameter, or invoke the new srvroutine in you used technique (2).
Re: VLF One Filter
If I did misunderstand your question could you post your filter and server module code + some more details on what you are trying to achieve please?
-
nazirul_fitri
- Posts: 21
- Joined: Thu Sep 15, 2016 7:00 pm
Re: VLF One Filter
Hi Mark,
I want to achieve something like picture below.
I want to have a filter with 4 user input (the picture only show 3):
1) Date
2) State
3) Branch
4) Product
If the user choose date only, so the first sql will run and show all the state, branch and product.
if the user select date and a state, the second sql will run and show a specific state will all the branch and all the product.
if the user select the date, state and branch, the third sql will run and show a specific state and specific branch with all the product.
same goes to if user select product.
I have tried with 2 user input and at the server routine i put :
I expect to show the specific state name with specific branch and all the product, but it not work.
I want to achieve something like picture below.
I want to have a filter with 4 user input (the picture only show 3):
1) Date
2) State
3) Branch
4) Product
If the user choose date only, so the first sql will run and show all the state, branch and product.
if the user select date and a state, the second sql will run and show a specific state will all the branch and all the product.
if the user select the date, state and branch, the third sql will run and show a specific state and specific branch with all the product.
same goes to if user select product.
I have tried with 2 user input and at the server routine i put :
Code: Select all
Select Fields(#TEMP_PENYATAList) From_File(SEARCH) Where('(#STATE_NAME *EQ #uState) *AND (#BRANCH_NAME *EQ #uBranch)')- Attachments
-
- filter.PNG (5.12 KiB) Viewed 10873 times
Re: VLF One Filter
Assuming that table SEARCH is defined on your PC (localhost) it might be simpler to debug your SELECT loop using a Windows form, instead of a web page and a server module. For example, there is a normally a shipped demonstration table named PSLMST, so by compiling this windows form I can more easily experiment with and debug various SELECT commands and WHERE expressions to see what results they show.
If you did this with your SELECT loop you might more easily find what is wrong with it.
Once that works you can transfer the logic into back into your server module.
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(219) Clientheight(95) Componentversion(2) Left(813) Top(98)
Define_Com Class(#PRIM_PHBN) Name(#TestSelectLoop) Caption('Test SELECT loop') Displayposition(1) Left(48) Parent(#COM_OWNER) Tabposition(1) Top(32) Width(137)
* ------------------------------------------------------------------
Evtroutine Handling(#TestSelectLoop.Click)
Define_Com Class(#deptment) Name(#TestDepartmentKey)
#TestDepartmentKey := "MKT"
Select Fields(#Empno #SurName #Deptment) From_File(pslmst) Where(#DEPTMENT = #TestDepartmentKey)
Use Builtin(MESSAGE_BOX_ADD) With_Args(#Empno #Surname)
Endselect
Use Builtin(MESSAGE_BOX_SHOW) With_Args(ok ok info *Component)
Endroutine
End_Com
Once that works you can transfer the logic into back into your server module.