Welcome! Log In Create A New Profile

Advanced

Indirection help

Posted by Georgio 
Georgio
Indirection help
February 18, 2009 08:53PM
Code:

PROCEDURE CheckCode(sCode is string="",bValData is boolean=True)

IF sCode <> "" THEN
	{gsQryName+"."+gsQryPCode,indQueryParameter} = sCode 
	HExecuteQuery({gsQryName},hQueryDefault)
	HReadFirst({gsQryName})

		// not a valid code
		IF NOT HFound({gsQryName}) THEN
			bValData = False
			NextTitle("Invalid Code! ")
			Info("The code you entered is invalid.  Please try again.    ")
		END
END

RESULT bValData

The code is failing on "HexecuteQuery" stating that the "file, view, or query is unknown". The query exists ... I just think that I'm not using indirection correctly.

Thanks!
Georgio
Re: Indirection help -- ooppss
February 18, 2009 09:03PM
Sorry ... i needs operators on the controls

IF sCode <> "" THEN
	{(gsQryName+"."+gsQryPCode),indQueryParameter} = sCode
	HExecuteQuery(({gsQryName}),hQueryDefault)
	HReadFirst({gsQryName})

		// not a valid code
		IF NOT HFound({gsQryName}) THEN
			bValData = False
			NextTitle("Invalid Code! ")
			Info("The code you entered is invalid.  Please try again.    ")
		END
END

RESULT bValData

Georgio
Fabrice Harari
Re: Indirection help
February 18, 2009 09:42PM
Hi Goergio,

2 things:

<CODE>
{(gsQryName+"."+gsQryPCode),indQueryParameter} = sCode
Can be simplified as
{gsQryName+"."+gsQryPCode,indQueryParameter} = sCode

and
HExecuteQuery(({gsQryName}),hQueryDefault)
should be
HExecuteQuery(gsQryName,hQueryDefault)
</CODE>

In the first case, the parenthesis are not needed (first parameter of an indirection is a string, and you do not need parenthesis to concatenate strings

In the second, it's even more simple, as hExecuteQuery accepts the name of a query as a string, therefore a variable containing a string should be immediately usable

Best regards

Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: