Access table outside the form

Questions, tips and tricks and techniques for scripting in Servoy

Access table outside the form

Postby felipebortoli017 » Tue Dec 04, 2012 2:32 pm

I have a form
This form is not connected to table
I need to access a table in the Database
How do in SQL?
EXAMPLE
There is a table "A" where I need to put a new value
To find the value
I will table B
and see what value is this field
See table B
that has a value and then update it based
save table B
and bring this new value to the table "A"
save table A

Help me
felipebortoli017
 
Posts: 24
Joined: Tue Mar 13, 2012 4:10 pm

Re: Access table outside the form

Postby david » Wed Dec 05, 2012 6:37 am

Checkout databaseManager.getFoundSet("server", "table") to get and manipulate foundsets without form binding. Some random sample code:


Code: Select all
var page = databaseManager.getFoundSet("sutra_cms","web_page")
page.find()
page.id_page = site.id_page__home
var count = page.search()
if (count != 1) {
   obj.error.code = 404
   obj.error.message = "No default page specified for this site"
   return
}
else {
   pageID = page.id_page
   databaseManager.refreshRecordFromDatabase(page, 0)
}
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.


Return to Methods

Who is online

Users browsing this forum: No registered users and 3 guests