Can I link to views dynamically?

Hi

I am trying to access my views dynamically, as opposed to hardcoded in my App code. Is this possible?

So far, this is all I could think of.

function getAppURI(myobj) {

    //1. Receiving

    if (myobj.uri_scheme == 'link.receiving_main') {

       link.receivng_main();

    }

    //2 Shipping

    if (myobj.uri_scheme == 'link.shipping_main') {

       link.shipping_main();

    }

    //3. Driver

    if (myobj.uri_scheme == 'link.driver_main') {

       link.driver_main();

    }

    //4. Maintenance

    if (myobj.uri_scheme == 'link.maintenance_main') {

       link.maintenance_main();

    }

}

To dynamically link to views, you need to use string notation rather than dot notation.

In the example above, remove the link. part from the data in the uri_scheme field and then access it as follows.

function getAppURI(myobj) {
  link[myobj.uri_scheme](); 
  // so this will translate into for example link['receiving_main']() which is the same as link.receiving_main()
  // OR
  navigate.link(myobject.uri_scheme); // if you prefer to use the newer navigate syntax
}