www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  DB/Textworks    Autopopulating data in another field
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
Hi,
We use DB Textworks for our Interloans database. Part of what we capture in each record is the library type we have sent the request to (Library Type). Each library type has an associated base cost, that we track (Costs). Is there any way I can autopopulate the "Costs" field when the "Library Type" field is populated? This would save us having to key the costs in (as they generally stay the same). Any clues?
Thanks
Jo Wink
 
Posts: 1 | Registered: Wed August 12 2009Reply With QuoteEdit or Delete MessageReport This Post
AT
Posted Hide Post
I have a similar script I use. Not sure how comfortable you are with Scripting but assuming you're ok - I use the Sample JavaScript Script 5 in the help on InMagic (below) to fill a box with part of “name1” (in the example case this is the first word of the text in field “name1” – name1 in your example would be Library Type) then I set up a validation list on the second field (“name2”, in your case Costs) to swap that autofill text with the amount. (i.e validation list where Video:1.20 Book:0.80 CD:1.50 etc)
Does that help?

function onRecordSave()
{
var srcBox = Form.boxes("name1");
if (srcBox) // be sure there is a box with the given name
{
var srcText = srcBox.content;
if (srcText != "") // proceed only if the first box is nonempty
{
var tgtBox = Form.boxes("name2");
if (tgtBox && tgtBox.content == "") // second box must exist and be empty
{
var allWords = srcText.split(" "); // allWords is an array of words
tgtBox.content = allWords[0];
}
}
}
}
 
Posts: 66 | Location: Essex | Registered: Fri April 29 2005Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  DB/Textworks    Autopopulating data in another field