Fetch table using blank Query for integer

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

juned_seskoad
Ebase User
Posts: 35
Joined: Mon Jul 14, 2014 11:55 pm

Fetch table using blank Query for integer

#1

Postby juned_seskoad » Tue Jul 29, 2014 3:45 pm

Dear All,

I have a table Order with field OrderNumber (integer)
i'm trying create form with table display and field OrderNumber for filter
when OrderNumber = Blank/Null, table will display all order and if OrderNumber not blank then filter as ordernumber entry

I have succes for character type of field using "%" but not for integer, please help me

Regards

Juned
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Wed Jul 30, 2014 9:37 am

You can do this by constructing the entire SQL where clause in code. It will be something like this:

In your Database Resource, add a resource field named for example WC by clicking the + button in the Resource fields panel. Make sure to uncheck the Persistent checkbox (most important).

Then in the Where clause box enter &&WC.

In your form create a new form field WC, then bring up the resource fields mapping panel by clicking the icon on the main toolbar for the form editor. Map the resource field WC to form field WC.

Then in the script where you are loading the table, you now need to set the WC variable to contain the appropriate SQL. Something like this (using Javascript):

Code: Select all

if (fields.ORDER_NO.value)
{
  fields.WC.value = "order_no= " +  fields.ORDER_NO.value;     // filter by order number
}
else
{
   fields.WC.value = "1=1";   // show all orders
}
Here's a link to the documentation that explains how to do this http://dev-docs.verj.io/ufs/doc/Databas ... c309125520. If you're concerned about the possibility of hackers attempting to use SQL injection, you should use the alternative technique described in the documentation which prevents against this.
0 x

juned_seskoad
Ebase User
Posts: 35
Joined: Mon Jul 14, 2014 11:55 pm

#3

Postby juned_seskoad » Wed Jul 30, 2014 11:41 am

Thanks Jon,

I just finish this document today and was implement it today and it work. thanks for your answer

Regards

Juned
0 x


Who is online

Users browsing this forum: No registered users and 23 guests