Rally Software

Expand all | Collapse all

Passing Variable Value from One Function To Another Function

Jump to Best Answer
  • 1.  Passing Variable Value from One Function To Another Function

    Posted 05-21-2020 05:08 PM
    Hi All,
    I have two functions _loaddata and _getQueryFilter. I would like to pass the variable value(which changes as per user value) from _loaddata function
    into the _getQueryFilter function(which is hard coded) and make it parameterized.I tried passing harFilters in _getQueryFilter, however it did not work.
    Is the scope has something to do with this,bringing the variable from one function to another?
    or should I specify something like scope:this or var that = this.
    Is calling _loaddata from _getQueryFilter a good idea?
    Any suggestions will be much appreciated.

    _loaddata:function(){
    var harFilters = '';
    harFilters = [Rally.data.wsapi.Filter.fromQueryString('((WorkProduct.Release.Name = "'+this.release.rawValue+'"))')];
    }

    _getQueryFilter:function(){
    filter = Rally.data.wsapi.Filter.fromQueryString('(((WorkProduct.Release.Name = "ABC PI XX.X"))')
    }

    Thanks
    Hardeep


  • 2.  RE: Passing Variable Value from One Function To Another Function

    Posted 05-22-2020 02:23 AM
    Woah! @Hardeepsingh Dhaliwal, it sounds like you are way off course in the weeds​. I am assuming you are talking about these functions that are part of the sdk file?

    If so, remember that any function that starts with an '_' is meant to be private to the type. Being private means that they are not usually things you want to change unless you have a very specific need.

    What are you trying to achieve: filtering for a load of a store based on some fixed parameter set, or on the settings in a query panel, or the filtering set on the page?

    For different examples on how to use filters, search for that word in this file: https://github.com/nikantonelli/PortfolioItemTimeLine/blob/master/App.js


    ------------------------------
    Nik
    Ask me a question, I'm All Ears!
    Rally Sales Engineer
    Rally Software
    ------------------------------



  • 3.  RE: Passing Variable Value from One Function To Another Function

    Posted 05-26-2020 01:18 PM
    Thank you Nik.

    I am trying to launch two app with the click of button. So basically trying to load data in two app with the click of a button, using the inter-app communication example. The two apps can communicate to each other with the simple message, however loading the data is not working. 

    Do you have any example where two apps or multiples apps are working with click of one button? 
    Some more elaborate example of inter-app communication.

    Thanks
    Hardeep


  • 4.  RE: Passing Variable Value from One Function To Another Function

    Posted 05-26-2020 02:01 PM
    I think what you are trying to achieve is overcomplicating things. An app is just a type class that is created by adding code to a page. The Rally.launchApp call fires off an app by using a ViewPort. Only one of these can exist at one time in a browser.

    If you want to have multiple apps, I suggest you try creating a single container that has two regions (left/right, up/down, etc.) and then create both type classes (using Ext.define followed vby Ext.create) and tell one of them about the left, and the other about the right.

    The two 'apps' (in reality just two object instances of the type class) can communicate with each other using the mechanisms you are reading about.

    ------------------------------
    Nik
    Ask me a question, I'm All Ears!
    Rally Sales Engineer
    Rally Software
    ------------------------------



  • 5.  RE: Passing Variable Value from One Function To Another Function

    Posted 05-26-2020 03:11 PM
    Thank you Nik,

    Is there any example of two apps (left/right, up/down, etc) from github which uses both type classes (using Ext.define followed vby Ext.create)? Or you can direct me to any similar link?

    The inter-app communication example in SDK documentation sends message however does not has Ext.create.

    Thanks
    Hardeep



  • 6.  RE: Passing Variable Value from One Function To Another Function
    Best Answer

    Posted 05-27-2020 08:37 AM
    No examples I can think of firing off two apps from a single click, and can't think of any that run two independent sections. Most people just create a page that is split in two regions and load two different apps, one into each region. Just clicking on the page starts the two apps. E.g: https://github.com/RallyCommunity/FilteredApps

    If I wanted something to kick off two different activities in the one app, the approach I would take would be something like this:

    Ext.define( 'MyMainApp', {
        extend: 'Rally.app.App',
        layout: 'hbox', /* create a left/right layout */
        items: [
            {
                xtype: 'container',
                itemId: 'leftBox',
                width: '50%'
            },        {
                xtype: 'container',
                itemId: 'rightBox'
            }
        ],

        launch: function() {
            Ext.create('MyLeftAppCode', {
                region: this.down('#leftBox')
            });
            Ext.create('MyRightAppCode', {
                region: this.down('#rightBox')
            });
      }

    Ext.define('MyLeftAppCode',{ /* fill in the code here to use 'region' */});
    Ext.define('MyRightAppCode',{ /* fill in the code here to use 'region' */});

    ------------------------------
    Nik
    Ask me a question, I'm All Ears!
    Rally Sales Engineer
    Rally Software
    ------------------------------



  • 7.  RE: Passing Variable Value from One Function To Another Function

    Posted 05-27-2020 01:59 PM
    Thank you Nik,
    I found the Broadcaster filter with listener example where the filter can be applied in multiple apps. 

    Can you please me let me know, how to use the source code? Can I use the same approach -> install rally-app-builder ->run "rally app build command".

    Here are the links:

    https://github.com/RallyTechServices/utils-ancestor-pi-app-filter

    https://github.com/RallyTechServices/pi-ancestor-filter-broadcaster