open rptdocument with different parameter value

ningli
edited February 11, 2022 in Analytics #1

Hi
I have created a dataset and using parameter to filter dataset(part of the dataset) create a chart. I saved the design to rptdocument file, can I open the rptdocument file with different parameter value to render report, what I really want is can change the selection get different view without run the query to the data base(since data is in the dataset), anyone can help me? Thanks ahead!

Best Answer

  • The <VALUE-OF> tag allows you to insert engine code in the Text element code which runs in the browser. The main issue with your code is that variables defined in the browser do not have scope in the engine. Also, I did some testing and I found that passing arrays does not appear to work. You can pass array element values from the engine to the browser, but not the full array. There are a couple of workarounds. The obvious one is to concatenate the values into a string, pass the string value, and then write code in the text element to parse it and optionally put the values in an array defined in the Text element. The other option for handling multiple values is to populate a data set with the values and add a Table element to the report. Replace the Data element in the detail row of the table with a Text element containing <VALUE-OF>row{"column_name"]</VALUE-OF>.

    Warning No formatter is installed for the format ipb

Answers

  • The best option if you are able to query the database one more time is to create a data object. Have it return all of the data (no filtering). It will cache the data locally. Then add parameters to the report to filter the cached data from the data object for a given run of the report.

    Warning No formatter is installed for the format ipb
  • Hi Jeff
    Thanks for the response, maybe I didn’t say clearly, on my query I got all the data I need, for example, the query return all the names of the team (no parameter in the query). When I build table I am using filters in property-editor-filters, which take a parameter and make a table only show the record with my name.
    Then I save the report to an rptdocument. When I open this document(not rptdesign file) again under tomcat or using report engine api, I want pass parameter show other people’s record(since all the records with different names are in the dataset) But parameter dialog box is not pop up, and passing parameter through url also didn’t change anything. So my question is that can I using parameter open rptdocument file change the outcome of html page.
    Ning

  • Hi Ningli,

    Rptdocuments should be considered static items. There are no longer parameters that can be passed to them as the document is fully generated. I'm not fully aware of all the options, but if you'd look below:

    Maybe what you're looking for would be something closer to http://otadocs.opentext.com/documentation/ihub3/help/adg/adg47/index.html#page/ADG/se-TestingDataSecurity.html

    Root document: http://otadocs.opentext.com/documentation/ihub3/help/adg/adg47/index.html#page/ADG/DataSecurity.1.1.html

    This would assume that you authenticate with the specific user that needs to access xyz data.

    Warning No formatter is installed for the format ipb
  • Hi Jeffery,

    thanks again, I will look at the link.

    Have a nice day

    Ning

  • Hi Jeffery
    haven't talk to you for a while and hopping everything is good!
    I have a question about tag <!VALUE-OF> and what is really do.
    Thanks in advance !
    I have an array called “myArray” defined in Report Design “initialize” function
    myArray = [];
    Index = 0;
    ArrayLength=0;
    totalList= [];
    In data onFetch function the value are assigned to the array and ArrayLength.
    Now I am try to use them in one of the text item (HTML/list)
    <!script>
    function myFunc() {

        1.  alert(<!VALUE-OF>ArrayLength</!VALUE-OF>);
        2.  alert(<!VALUE-OF> ArrayLength </!VALUE-OF>);
        3.  alert(<!VALUE-OF>totalArray[Index]</!VALUE-OF>);
    

    3. alert(<!VALUE-OF>totalArray[8]</!VALUE-OF>);

        4.  alert(<!VALUE-OF>totalList.pop()</!VALUE-OF>);
        5.  alert(<!VALUE-OF>totalList.pop()</!VALUE-OF>);
        6.  alert(<!VALUE-OF>totalList.pop()</!VALUE-OF>);
    

    }
    <!/script>

    The first three alert is working as I expected. What I want to do the get all the data in the array and use them in the function.

    Something like
    Var M``yvar
    For (Index =0; Index< ArrayLength; Index++)
    {
    Myvar = <!VALUE-OF>totalArray[Index]</!VALUE-OF>;
    ….
    }
    It complain Index in the totalArray[Index] in invalid.
    Or
    Var i;
    For (i=0; i< ArrayLength); i++ ){ myVar = <!VALUE-OF>totalArray[i]</!VALUE-OF>;

    Basically I can’t change the index for the array no mater I am using local variable or global variable,

    <!VALUE-OF>Index</!VALUE-OF>++;
    Index++;

    Also if you look at the 4-6 it is always give (not ‘pop up’) the last item in the list, the size of the list never changed.

    I am try to using reportContext.getGlobalVariable.. but can’t make it work. How can I change the data value between = <!VALUE-OF> </!VALUE-OF>;

    Thanks and have nice day….

  • this is the design file as you can see it only popup alert with hard coded array index.

  • The <VALUE-OF> tag allows you to insert engine code in the Text element code which runs in the browser. The main issue with your code is that variables defined in the browser do not have scope in the engine. Also, I did some testing and I found that passing arrays does not appear to work. You can pass array element values from the engine to the browser, but not the full array. There are a couple of workarounds. The obvious one is to concatenate the values into a string, pass the string value, and then write code in the text element to parse it and optionally put the values in an array defined in the Text element. The other option for handling multiple values is to populate a data set with the values and add a Table element to the report. Replace the Data element in the detail row of the table with a Text element containing <VALUE-OF>row{"column_name"]</VALUE-OF>.

    Warning No formatter is installed for the format ipb
  • Thanks, I will try this! really appreciated. have a nice day!

  • Hi Jeffery

    I combined result set to a big string and pass it to the callback function and parse it into a array, now I am able to get all the elements I need,
    thank you very much!
    have a nice day!

    Ning