If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Seach and Select Prompt - Reset

Started by zamcognos, 04 Feb 2021 01:50:49 PM

Previous topic - Next topic

zamcognos

I have a requirement to reset the prompts on click of the button. I am able to clear the  VALUE prompts using the clearValues() JavaScript API in a customControl, but with a Search and Select prompt the clearValues() function only clears the selected value from the results pane, but we are required to clear the input keywords and the results too from the results pane, I can clear them by setting the .value attribute of input tag(for keywords) and resetting the html of the Div that contains the results choices, but when the page reloads the previously selected keywords and the results choices reappear.

zamcognos

Report XML

<report xmlns="http://developer.cognos.com/schemas/report/15.5/"           expressionLocale="en-us" useStyleVersion="11.6">
            
            <drillBehavior/>
            <layouts>
               <layout>
                  <reportPages>
                     <page name="Page1">
                        <style>
                           <defaultStyles>
                              <defaultStyle refStyle="pg"/>
                           </defaultStyles>
                        </style>
                        <pageBody>
                           <style>
                              <defaultStyles>
                                 <defaultStyle refStyle="pb"/>
                              </defaultStyles>
                           </style>
                           <contents><table><style><CSS value="border-collapse:collapse;width:100%"/><defaultStyles><defaultStyle refStyle="tb"/><defaultStyle refStyle="GuidedLayoutMargin"/></defaultStyles></style><tableRows><tableRow><tableCells><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse"/></style><tableRows><tableRow><tableCells><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top"/></style></tableCell><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top"/><defaultStyles><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow></tableRows></table></contents><style><CSS value="text-align:left;vertical-align:top;width:50%"/><defaultStyles><defaultStyle refStyle="GuidedLayoutRightPadding"/></defaultStyles></style></tableCell><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top;width:50%"/><defaultStyles><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow></tableRows></table><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse"/></style><tableRows><tableRow><tableCells><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents><textItem><dataSource><staticValue>Select Year</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Select Month-Year</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Search and Select Product Type</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Select Order Method</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents><selectValue name="PeriodPmt" parameter="p_period" refQuery="Query2" selectValueUI="radioGroup" autoSubmit="true"><style><CSS value="height:60px"/></style><defaultSelections><defaultSimpleSelection>2011</defaultSimpleSelection></defaultSelections><selectOptions><selectOption useValue="2011"><displayValue>2011</displayValue></selectOption><selectOption useValue="2012"><displayValue>2012</displayValue></selectOption></selectOptions><useItem refDataItem="Year"><displayItem refDataItem="Year"/></useItem></selectValue></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><selectValue cascadeOn="p_period" name="MonthPmt" parameter="p_months" refQuery="Query2"><useItem refDataItem="Month key"><displayItem refDataItem="Month (caption)"/></useItem></selectValue></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><selectWithSearch hideAdornments="true" name="SNS" parameter="p_product" refQuery="Query1"><useItem refDataItem="Product"><displayItem refDataItem="Product"/></useItem></selectWithSearch></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><selectValue name="OrderMethodPmt" parameter="p_orderMethod" refQuery="Query3"><useItem refDataItem="Order method type"><displayItem refDataItem="Order method type"/></useItem></selectValue></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse;width:100%;border:1pt solid black"/></style><tableRows><tableRow><tableCells><tableCell><contents><promptButton type="finish">
                                                                                                <contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="margin:0px;border-collapse:collapse;width:46px;height:22px"/></style><tableRows><tableRow><tableCells><tableCell><contents><textItem><dataSource><staticValue>✓</staticValue></dataSource><style><CSS value="font-family:&apos;Davita Icons&apos;;font-size:14px;color:#1566A7;width:15px;height:17px"/></style></textItem></contents><style><CSS value="text-align:left;vertical-align:middle;padding-right:4px"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Apply</staticValue></dataSource></textItem></contents><style><CSS value="text-align:left;height:22px;width:46px;vertical-align:middle;font-family:Lato;font-size:16px"/></style></tableCell></tableCells></tableRow></tableRows></table></contents>
                                                                                                <style>
                                                                                                   <CSS value="padding:0px;height:22px;width:46px;color:#1566A7;border-top-style:none;border-bottom-style:none;border-left-style:none;border-right-style:none;background-color:white"/></style>
                                                                                             </promptButton></contents><style><CSS value="padding-right:10px;border:1pt solid black"/></style></tableCell><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="margin:0px;border-collapse:collapse;width:46px;height:22px"/></style><tableRows><tableRow><tableCells><tableCell><contents><textItem><dataSource><staticValue>x</staticValue></dataSource><style><CSS value="font-family:&apos;Davita Icons&apos;;font-size:14px;color:#1566A7;width:15px;height:17px"/></style></textItem></contents><style><CSS value="text-align:left;vertical-align:middle;padding-right:4px"/></style></tableCell><tableCell><contents><customControl description="CustomReset" name="CustomFinishCancelClear" path="/javascript/poc/clearPrompts.js"><configuration>{
    &quot;noSelectPrompts&quot;: [
        &quot;OrderMethodPmt&quot;,
        &quot;MonthPmt&quot;
    ],
    &quot;SnSPrompts&quot;: [
        &quot;SNS&quot;
    ],
    &quot;preSelectPrompts&quot;: [
        {
            &quot;promptName&quot;: &quot;PeriodPmt&quot;,
            &quot;promptDefault&quot;: [
                {
                    &quot;use&quot;: &quot;2011&quot;,
                    &quot;display&quot;: &quot;2011&quot;
                }
            ]
        }
    ]
}</configuration></customControl></contents><style><CSS value="text-align:left;height:22px;width:46px;vertical-align:middle;font-family:Lato;font-size:16px"/></style></tableCell></tableCells></tableRow></tableRows></table></contents><style><CSS value="padding-right:20px;padding-left:10px"/><defaultStyles><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow></tableRows></table></contents><style><CSS value="vertical-align:top;padding-left:30px"/><defaultStyles><defaultStyle refStyle="GuidedLayoutTopPadding"/><defaultStyle refStyle="GuidedLayoutBottomPadding"/><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents/><style><CSS value="vertical-align:top"/></style></tableCell><tableCell><contents/></tableCell><tableCell><contents><customControl description="defaultSnS" path="/javascript/defaultSnS-min.js" uiType="none"><configuration>{
    &quot;promptName&quot;: &quot;SNS&quot;,
    &quot;option&quot;: 3,
    &quot;height&quot;: 250
}</configuration></customControl></contents></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents><promptButton type="reprompt" name="RepromptButton">
         <contents><textItem><dataSource><staticValue>Display Parameters Selected</staticValue></dataSource></textItem></contents>
         <style>
            <defaultStyles>
               <defaultStyle refStyle="bp"/>
            </defaultStyles>
         </style>
      </promptButton></contents></tableCell><tableCell><contents><textItem><dataSource><staticValue>Product Type Selected</staticValue></dataSource></textItem></contents><style><CSS value="text-align:right"/></style></tableCell><tableCell><contents><textItem><dataSource><reportExpression>ParamDisplayValue(&apos;p_product&apos;)</reportExpression></dataSource></textItem></contents></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow></tableRows></table></contents>
                        </pageBody>
                     </page>
                  </reportPages>
               </layout>
            </layouts>
         <queries><query name="Query1">
         <source>
            <model/>
         </source>
         <selection><dataItem aggregate="none" rollupAggregate="none" name="Product"><expression>[Sales (query)].[Products].[Product type]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection>
      </query><query name="Query2"><source><model/></source><selection><dataItem aggregate="none" rollupAggregate="none" name="Year"><expression>[Sales (query)].[Time].[Year]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="1"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem><dataItem aggregate="none" name="Month"><expression>[Sales (query)].[Time].[Month]</expression></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month key"><expression>[Sales (query)].[Time].[Month key]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="1"/><XMLAttribute output="no" name="RS_dataUsage" value="1"/></XMLAttributes></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month (caption)"><expression>[Sales (query)].[Time].[Month (caption)]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month1"><expression>[Sales (query)].[Time].[Month]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month number"><expression>[Sales (query)].[Time].[Month number]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="1"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection><detailFilters><detailFilter><filterExpression>[Year] in (&apos;2011&apos;,&apos;2012&apos;)</filterExpression></detailFilter></detailFilters></query><query name="Query3">
         <source>
            <model/>
         </source>
         <selection><dataItem aggregate="none" rollupAggregate="none" name="Order method type"><expression>[Sales (query)].[Order method].[Order method type]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection>
      </query></queries><XMLAttributes><XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/><XMLAttribute output="no" name="listSeparator" value=","/><XMLAttribute output="no" name="decimalSeparator" value="."/><XMLAttribute output="no" name="RS_modelModificationTime" value="2015-11-25T21:38:24.820Z"/></XMLAttributes><classStyles><classStyle name="GuidedLayoutLeftPadding"><CSS value="padding-left:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutTopPadding"><CSS value="padding-top:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutRightPadding"><CSS value="padding-right:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutBottomPadding"><CSS value="padding-bottom:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutMargin"><CSS value="margin-bottom:10px"/></classStyle></classStyles><modelPath>/content/folder[@name=&apos;Samples&apos;]/folder[@name=&apos;Extended&apos;]/folder[@name=&apos;Models&apos;]/package[@name=&apos;GO sales (query)&apos;]/model[@name=&apos;model&apos;]</modelPath><reportName>resetPrompts</reportName></report>