Page 1 of 1

Using Java Script

Posted: Wed Jun 13, 2012 4:01 pm
by Christos
I am new to Java, I try to read from a table called Input and write in Input fields, Table has 2 columns -
Topic & Description

Java Script-1
Read Database

Code: Select all

if(Global.UserData == undefined) 
{
	Global.UserData = Global.DataBase.Query("Select * FROM Input")
}
if(Global.UserData.Read()) return true;
else return false;
Writing from 1st Row For Topic

Code: Select all

Global.Browser.Selection.GetItem(0).value = Global.UserData.GetValue(0);
Writing from 2nd Row For Description

Code: Select all

Global.Browser.Selection.GetItem(1).value = Global.UserData.GetValue(1);
But it is not working, What can I do to make it work?

Re: Using Java Script

Posted: Thu Jun 14, 2012 2:00 am
by webmaster
Try replacing

Code: Select all

Global.UserData = Global.DataBase.Query("Select * FROM Input")
for

Code: Select all

Global.UserData = Global.DataBase.Query("Select * FROM [Input]")
Since Input is a keyword you need to use brackets. If you look at the log (Project -> View Log) you'll see this code is throwing an error.

Let me know if there are any other doubts.