Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 11:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Populating Text Field With Records From An Access Database
PostPosted: January 3rd, 2011, 10:43 pm 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Hi,
Please bear with me as I know little about databases and how they interact with Opus Pro.

I created an Access database. I read the Opus Pro Help and tutorials and was able to display in an Opus Pro Text field a specific field from the first record in the table. I also can use the Previous and Next record actions to show the next and previous.

But what I'd like to do is show all records (including all fields) in a list at one time, like a grid.

Is that possible?

Thanks,
Mike


For this message mbain has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Populating Text Field With Records From An Access Databa
PostPosted: January 3rd, 2011, 11:23 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
As Mackavi mentioned in an older post, there is help and example (for part of this) in the OpusScript help file. Do a search there for: getnumberofrecords --- and you will find this below and more:
Quote:
Database Functions - Introduction

Below is a simple OpusScript example showing how you can use the OpusScript Database functions in a Script Object or Script Action. The example shows in which order you should use the Database functions.

The full script is:

var db = new Database("DSN=Products;")
var RecSet = db.ExecuteSQL("SELECT Price, Qty FROM Customer_Order WHERE OrderID=1;")
var total = 0

// Setup loop for all the records found
for (var i=1; i<= RecSet.GetNumberOfRecords(); i++)
{
total += RecSet.Price * RecSet.Qty
RecSet.NextRecord() // Move to the next record
}

Explaining the Example: [continues in the Help File]
Here is a suggestion for adapting the above to your scenario.

var onerecord = "" ;
var mylisting = "";
//Use a LOOP as above
//Now to achieve what you want (All Fields) replace that one line of code above (total += etc etc)
onerecord = field1 +"\t" +field2 +"\t" +field3 +"\t" +field4 ;
mylisting += onerecord +"\n" ; //appends records and a newline (as written, will leave an extra "\n" at the end)

That should get you on-track. You can find previous discussions in forum: loop records

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Populating Text Field With Records From An Access Databa
PostPosted: January 4th, 2011, 5:14 am 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Thanks very much! I'll read all the info you referenced and see if I can get it done.


For this message mbain has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group