in form query - no results

Questions, tips and tricks and techniques for scripting in Servoy

in form query - no results

Postby TonyK » Mon Dec 20, 2010 7:11 pm

I need to query a Foxpro table where the two columns being searched are different data types, one an integer the other a string. Having searched the forum I found something that looked very much like what I was trying to do and yet I do not seem to get any results appearing in my form.

The following is triggered by a button OnAction event, but my form doesn't refresh with the results. Am I missing something or doing something wrong?
I've left in a commented version of the query which I started with.

Code: Select all
   //var _sQuery = "SELECT unq_id FROM trunk WHERE cast(trunkno, 'string') LIKE ? OR trunkname LIKE ?"; // pseudo sql
   var _sQuery = "SELECT unq_id FROM trunk WHERE trunkno LIKE ? OR trunkname LIKE ?"; // pseudo sql
   var _sArg = "%" + globals.SrchFor + "%";
   controller.loadRecords(_sQuery, _sArg, _sArg);

Any help appreciated.

Tony
TonyK
 
Posts: 42
Joined: Mon Sep 27, 2010 6:07 pm

Re: in form query - no results

Postby Kaptan » Mon Dec 20, 2010 7:33 pm

You have to pass the arguments as an array.
Code: Select all
controller.loadRecords(_sQuery, [_sArg, _sArg]);
Sem
Kaptan
 
Posts: 124
Joined: Mon Aug 04, 2008 11:17 pm
Location: Amsterdam

Re: in form query - no results

Postby TonyK » Tue Dec 21, 2010 11:02 am

Many thanks, it works now! :D
TonyK
 
Posts: 42
Joined: Mon Sep 27, 2010 6:07 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 8 guests

cron