COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: patrickthatcher on 12 Aug 2015 02:10:10 PM

Title: Prompt API. Is possible to get previously submitted value?
Post by: patrickthatcher on 12 Aug 2015 02:10:10 PM
I have code for a drop-down prompt to set the value to the first record when the prompt is displayed.  If the user submits the report and then decides to rerun the report, understandably, the drop-down always goes back to first record versus what they might have previously selected.  Is there a way determine if the drop-down had a previous value? If I disable the code and run it, what I previously had chosen does display as expected.

thank you


<script>
//<!–
//This will set the default value to the first entry

//get report
var oCR = cognos.Report.getReport("_THIS_");

var oP = oCR.prompt.getControlByName("P1DailyDate");


  // Get the values and isolate the first value.
  var allValues = oP.getValues(true);
  var firstValue = allValues[0];

  // Set the prompt selection to the first value.
  oValues = [firstValue];
  oP.setValues(oValues);

//–>
</script>
Title: Re: Prompt API. Is possible to get previously submitted value?
Post by: patrickthatcher on 12 Aug 2015 03:21:50 PM
I think I may have found the answer here: http://www.cognoise.com/index.php/topic,25639.msg81237.html#msg81237