Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10313

Re: Question regarding Screen Navigation

$
0
0

Here are a couple of ways I would approach the problem.

 

Can you modify the MBO to return the desired information?

 

For example if using the included sample database and the employee and department tables and wished to show the department name in addition to the employee details, modify the SQL for the employees MBO to be something like

 

  SELECT   emp_id, emp_fname, emp_lname, manager_id, department.dept_name FROM employee KEY JOIN department

 

 

 

If that is not possible and you wish to execute another query when the user navigates from the listview, you could do something like the following.

 

In the following case, the goal was to show the employee records and include in the details page the managers name.

 

I created two MBO,

emp

  SELECT   emp_id,

  emp_fname,

  emp_lname,

  manager_id

  FROM sampledb.dba.employee

 

and

 

emp_mgr

SELECT emp_id AS mgr_id, emp_fname +' ' + emp_lname AS mgr_name FROM employee

 

Notice the use of AS to create attribute names which become key names that are different between the two MBO's.

 

This MBO has an object query named findManager that is defined as

SELECT x.* FROM emp_mgr x

WHERE x.mgr_id = :mgr_id_param

 

The hybrid app consists of a emp screen that shows a listview of the employees and a details page.

On the details screen add a custom action named GetMgrDetails which will perform an online request to call the findManager object query.  It will need to have its parameter mapping filled in and have its success screen set to the details screen.  Then add another textfield named Manager: and set its key to be the manager name returned from the GetMgrDetails object query.

 

Then in Custom.js

 

hwc.customAfterNavigateForward = function(screenKey, destScreenKey) {

          if ((screenKey == "emp") && (destScreenKey == "empDetail")) {

                    menuItemCallbackempDetailGetMgrDetails();

          }

};

 

Hope that helps,

 

Dan van Leeuwen


Viewing all articles
Browse latest Browse all 10313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>