DragonRAD Forum
June 19, 2013, 04:32:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Select query for lookup tables based on Logged in user  (Read 837 times)
wesoos
Member
***
Posts: 106


View Profile
« on: November 18, 2010, 08:44:46 AM »

Hello, wondering if this is a bug or if I'm doing something wrong, but in my lookup tables I have a where clause in the select statement of the sync rule.  The clause uses a value from the logged in user data object, something like the following:

where GroupId = :LoggedInUser.GroupId:

This seems to work fine at first, but when I leave the app, log back in with a different user, it doesnt work anymore.  No data are returned.  Am I correct by assuming that after logging in, it syncs all the tables in the app?

Any ideas?

Thanks
Logged
IanBowles
Administrator
*****
Posts: 122


View Profile
« Reply #1 on: November 18, 2010, 10:48:41 AM »

No synchs will be done after login - you'd have to do that yourself. We automatically run the GetAll on initial load of the app, but that is all. 
Logged
CamRose
Guest
« Reply #2 on: November 18, 2010, 11:22:15 AM »

As a simple solution you could add a "OnLoadAction" that calls a "Get All" on to the top level form of your application. This would update your table. Here are the steps:

1. Select the Top Level form of your application.
2. Click "OnLoadActions" Under "Properties" -> "Screen Action Scripts"
3. Select "Synch" under the "Field Actions" tab.
4. Select "Get All" or what every synch rule will update your table.
Logged
wesoos
Member
***
Posts: 106


View Profile
« Reply #3 on: November 18, 2010, 12:42:12 PM »

Will it update all the tables in the application, or do i have to create an action for all the tables?
Logged
CamRose
Guest
« Reply #4 on: November 18, 2010, 12:56:32 PM »

You either need to use an action or you can use a script. Make sure to call the sync rule that does update you would like. I just chose "Get All" because it is there by default.


Cam
Logged
wesoos
Member
***
Posts: 106


View Profile
« Reply #5 on: November 18, 2010, 01:01:52 PM »

Can you give me an example of how to run a sync rule using script please?

Thanks
Logged
CamRose
Guest
« Reply #6 on: November 18, 2010, 01:22:21 PM »

No problem here is an example of calling "Get All" using Lua scripting.

1. Select the Top Level form of your application.
2. Click "OnLoadActions" Under "Properties" -> "Screen Action Scripts"
3. Select "Script" under the "Field Actions" tab.
4. Click "New Script" and add this text code "clientevent.app.runSynchRule("GetAll")

That should do it.
Logged
wesoos
Member
***
Posts: 106


View Profile
« Reply #7 on: November 18, 2010, 01:30:07 PM »

Thanks!  Will I be able to reference sync rules from all different tables within that app, in that script?
Logged
CamRose
Guest
« Reply #8 on: November 18, 2010, 01:42:36 PM »

Yes, just use the name of the synch rule you want to call.
Logged
wesoos
Member
***
Posts: 106


View Profile
« Reply #9 on: November 18, 2010, 02:04:52 PM »

Since all the tables in the application has a GetAll rule, will all the GetAll rules for all the tables be called?  Or do i need to create a different sync rule for each table?
Logged
CamRose
Guest
« Reply #10 on: November 18, 2010, 02:16:11 PM »

All of them will be called.

Cam
Logged
IanBowles
Administrator
*****
Posts: 122


View Profile
« Reply #11 on: November 18, 2010, 02:22:29 PM »

You can of course define a different rule that only reloads certain tables
Logged
wesoos
Member
***
Posts: 106


View Profile
« Reply #12 on: November 18, 2010, 02:32:11 PM »

Yeah sorry, I got it now.  Didn't realize rules apply to all tables unless configured otherwise...Thanks.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!