www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  DB/Textworks    scripting to secondary record
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
Hi. I would like to make a script button to go directly to the secondary record from the main one , instead of using ALT+F2 every time. Does anybody know if it's possible? I'm using Db/TextWorks 5.2.
Thank you in advance.
B.
 
Posts: 10 | Location: Barcelona, Spain | Registered: Tue October 03 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
As long as you have only one secondary textbase, it should be as simple as adding a script button to your edit form, naming it (I named mine "button"), and creating a script like the following:

function button_onClick()
{
Command.editSecondaryRecord();
}

If you have multiple secondary textbases, you'll probabably have to use setFocus() to set the focus to the edit box for the appropriate secondary textbase first (remember to name the form box on the Form Script dialog box):

function button_onClick()
{
Form.boxes("SerCatID").setFocus();
Command.editSecondaryRecord();
}
 
Posts: 217 | Registered: Wed June 29 2005Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Thank you very much, CDale. I'll try if it works!
B.
 
Posts: 10 | Location: Barcelona, Spain | Registered: Tue October 03 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Yes, it works!!!

By the way, I was wondering if there is any way -I think I'm dreaming!- of link textbases using the model one-to-many?
For instance, I've the main database which contains books, and the secondary one that includes the loan (each document has its own record), so each item in the primary textbase could have one or more records related in the second one. Is it possible to retrieve multiple secondary records?... Is it possible to navigate throw the whole records retrieved in the secondary textbase?

Thank you in advance, and please sorry my english.

B.
 
Posts: 10 | Location: Barcelona, Spain | Registered: Tue October 03 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
For the Catalog & Loans model, you need to flip the textbases so the Loans textbase is the primary textbase and the Catalog and Borrower textbases are the secondary textbases. That's how DB/Text for Libraries and Inmagic Genie both work.
 
Posts: 217 | Registered: Wed June 29 2005Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Hi

Of course, CDale is right that using Inmagic linking you can only make the link from the multiple loans to the one catalog record.

But it is possible to add a script to a report form in catalog that can search for all the related records in loans and show fields from those records in the form. I have found that this works well in a Display form, less well in a Report form, especially if there is a large number of records. (of course this is in TextWorks)

Something similar can be achieved using WebPublisher PRO and a canned search on the web.

Hope this helps

Norma


Maxus Australia
Authorised Inmagic Partner
 
Posts: 48 | Location: Melbourne, Australia | Registered: Thu July 17 2003Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Thank you both for your help.
I'll try adding a script to report form, as Norma suggests, although this would be my second experiment with scripting.
Bye!
B.
 
Posts: 10 | Location: Barcelona, Spain | Registered: Tue October 03 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Hi,

I've been trying for a long time what Norma suggests, but my poor experience with scripting becomes a problem at this point.

Could anywone shows me the way for writing the script properly?

Thank you very very much.

B.
 
Posts: 10 | Location: Barcelona, Spain | Registered: Tue October 03 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Here is some vb script that will perhaps get you started

I wrote it for a display screen. You need boxes in the form for the record ID (named ID) and a script inut box named loans

You might need to change the name of the textbase in

set lrs = application.newrecordset("loans","path to loans","loans password")

if it is not loans. Also enter the path to your loans textbase and a password if needed in the places indicated.

A field called CatID exists in Loans and contains the same entry as the ID in the catalog. Fields Borrower, Due date and Barcode also exist in loans.

sub onrecordopen()

'get record ID from screen
ID = form.boxes("ID").content

'Find records for this item in Loans

set lrs = application.newrecordset("loans","path to loans","loans password")

lrs.open("find catid = " + ID)

text=""

numrecords = lrs.recordcount()

lrs.movefirst()

for n = 1 to numrecords

'get Name
set f=lrs.fields.item("borrower")
bname = f.value

'get Barcode
set f=lrs.fields.item("barcode")
barcode = f.value

'get Due date
set f=lrs.fields.item("due date")
due = f.value

'add to text for display
text = text + vbcrlf + barcode + " Borrower " + bname + " Due back " + due

lrs.movenext()

next

form.boxes("loans").content = text

end sub

Hope this helps

Norma


Maxus Australia
Authorised Inmagic Partner
 
Posts: 48 | Location: Melbourne, Australia | Registered: Thu July 17 2003Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Thank your Norma, i'll try it!

B.
 
Posts: 10 | Location: Barcelona, Spain | Registered: Tue October 03 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Hi

Does anyone have a version of this script (or similar) in JScript that they would be able to share?

Thanks!
 
Posts: 1 | Registered: Sun January 06 2008Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  DB/Textworks    scripting to secondary record