Jason,
Here is my code.
Code:
var db = new Database("FILEDSN=lasselsbergerVT.dsn");
var records = null;
//////////////////////////////////////////////////////////////////////////////
//
// NOTE: Start_Record_Num is the record number for the first of the 5 records
// and it is a Page Variable
//
function SearchDB()
{
var sql = "SELECT * FROM Artikel WHERE Omschrijving LIKE '"%zoekserie%"' ORDER BY Code;";
// Debug.trace(sql+"\n");
records = db.ExecuteSQL(sql);
ShowRecords()
}
function ShowRecords()
{
if (records == null) {
return; // need to call Search First to get records
}
var num_records = records.GetNumberOfRecords();
if (num_records > Start_Record_Num) {
// Jump to record that will be the first to be shown
records.GetRecordAt(Start_Record_Num);
}
// Get first five records
for (num=1; num<=5; num++)
{
var text_box = FindChild("Text "+num); // Get Text box called Text 1, Text 2 ...
text_box.SetSelection(0, -1); // Select all text in box
if (num <= (num_records - Start_Record_Num + 1)) {
text_box.ReplaceSelection(records.Code);
} else {
text_box.ReplaceSelection(""); // Clear the text box
}
text_box = FindChild("Formaat "+num);
text_box.SetSelection(0, -1);
if (num <= (num_records - Start_Record_Num + 1)) {
text_box.ReplaceSelection(records.formaatlengte); // Set the text in the text box
} else {
text_box.ReplaceSelection("");
}
text_box = FindChild("Formaatl "+num);
text_box.SetSelection(0, -1);
if (num <= (num_records - Start_Record_Num + 1)) {
text_box.ReplaceSelection(records.formaatbreedte); // Set the text in the text box
} else {
text_box.ReplaceSelection("");
}
text_box = FindChild("Kleur "+num);
text_box.SetSelection(0, -1);
if (num <= (num_records - Start_Record_Num + 1)) {
text_box.ReplaceSelection(records.Kleur); // Set the text in the text box
} else {
text_box.ReplaceSelection("");
}
records.NextRecord();
}
}
function Next()
{
var num_records = records.GetNumberOfRecords();
if (Start_Record_Num + 5 < num_records) { // Check there are 5 more records
Start_Record_Num += 5;
}
ShowRecords();
}
function Previous()
{
Start_Record_Num -= 5; // Go Back 5 Records
if (Start_Record_Num < 1) { // Check not gone too far
Start_Record_Num = 1;
}
ShowRecords();
}
In this script textfields are filled with textdata, is it possible to display images with the script above, I know it is possible with regular variable settings>
Code:
<SYSTEM_PUBLICATION_DIR>\artikelbestanden\tegels\<afbeeldingvt>.jpg
Ronnie