Prompt Page Requires Entry, Required set to No - cognos

I have a report that I developed that utilizes render variables as described here.
My prompt page has 3 check box groups filled with variables. My first box is set to required, as it contains key information that needs to be pulled. The 2nd and 3rd have optional values. When the report runs, it requires at least one of the options in box 2 and 3 to be selected.
Any idea?

If a parameter is referenced directly in a query data item, Cognos will force it's associated prompt to be required even if you set it to 'Optional'. If this is the issue, the solution is to use a prompt macro instead of the normal ?? syntax. You set a default value to pass if the prompt isn't satisfied. This allows the prompt to act like an optional prompt.
The minimum syntax is:
#prompt('prompt_name','string','')#
The third parameter is the default value. I have just used an empty string here but you could change this to whatever you want.

Related

For Cognos 11.1.7 Trying to figure out the syntax for a macro prompt where I can set the default to be all members

Cognos 11.1.7
Need help with syntax on a macro prompt so the default can be to select all members
Here is a simple example that works
set([Generic].[Groups].[Location].[Location] -> ?Location?)
If I wanted to hard code a value I could use this as a slicer
[Generic].[Groups].[Location].[Location]->[all].[1]
What is the syntax for creating a macro prompt with a default of all members?
i.e. instead of ?Location?
Something like this:
#Prompt('Location', 'token', '[all]')#
or maybe like
#Prompt('Location', 'memberuniquename', '[all]')#
Open to using different techniques (filter, set, etc)
Fill in the default text parameter of the prompt macro.
https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=macros-mandatory-optional-prompts
"DefaultText
This optional parameter is the text to be used by default. If a value is specified, the prompt is optional.
If you use a space and no values are provided in the Prompt Value dialog box, a Where clause is usually not generated.
If you use text and no values are provided in the Prompt Value dialog box, a Where clause is usually generated using the default value.
Ensure that the text you provide results in a valid SQL statement."
https://www.ibm.com/support/pages/using-prompt-macro-optional-andor-required
You can also set a property in the filter in FM to make it optional.
Both
#Prompt('Location', 'memberuniquename', '[Generic].[Groups].[Location].[Location]->[all].[1]')#
and
#Prompt('Location', 'token', '[Generic].[Groups].[Location].[Location]->[all].[1]')#
should work. You also have the option to set a default value on the actual prompt object.

RSV-VAL-0034 Failed to validate the variable 01. CRX-API-0016 The expression input string is empty: """" IBM

I am using Version 11.1.2fp2 IBM Cognos. I have many simple case statements that do not validate. The Report Runs. The report produces the expected output of data.
The error is RSV-VAL-0034 Failed to validate the variable 01. CRX-API-0016 The expression input string is empty: """".
CASE
WHEN [Grant Agency TRACCD FRGBIL FOBTEXT with Budgets].[REAUTH_SDE_LAWS] IS MISSING
THEN ''
ELSE TRIM([Grant Agency TRACCD FRGBIL FOBTEXT with Budgets].[reauth_law_chapter])
END
Kindly, I have attached a screen shot with the Do you have any insights?
The CRX error family is usually linked to variable or report expressions, which means it's probably not tied to the data item case statement. Given the report runs it may also indicate the report expression is not actually used anywhere.
Please have a look at: https://www.ibm.com/support/pages/crx-api-0016-report-upgrade
The "Validate" button in the Data Item Expression dialog doesn't validate that expression. It validates the entire report. It is often misleading because the message displayed may have nothing to do with the expression you are looking at.
Here's what to do.
Close the Data Item Expression dialog.
Click on the More button in the top right (the 3 dots arranged vertically).
Select Validate report.
Select the first item in the Validation response.
Click Select.
If Cognos chooses to be nice to you, it will navigate to and highlight the offending object.
#dougp mentioned, an unprocessable variable from cognos is just what happened. Sometimes it might get hard to find the variable itself. One way of finding it is to get the xml definition and the search for the the declared variable.
Reimporting the report won’t overwrite until you choose the saving location.
The root cause is the variable "Boolean1" was never used by the report. The variable "Boolean1" was not tied to the data item in the case statement. I created the variable "Boolean1" and forgot about it. I did not use the variable "Boolean1" in the report. I found the variable "Boolean1" and removed it. Now my validation of the report expressions works fine. I value your insights.

Primefaces SelectOneMenu, selection on filter

A user of one of my applications has observed a strange behaviour of the selectOneMenu of Primefaces when using filters.
I have a mask with some fields, some of them are selectOneMenues. I deliver values via a map of Strings and use a filter on them, so the user can search for specific values, in this case currencies.
I have set a default value for this field (as the value in the object behind this field).
So, imagine the following case:
User opens the mask - default value is set on the selectOneMenues
User klicks the arrow on the field and opens the list of available values
he types in some characters and a result is returned (he finds various values with it)
when this happens, in the field, the first value from the result list is set automatically
when the user now selects a random entry, it is set and everything is fine
if the user instead decides he want's the default value back he could either click somewhere on the mask and the value is resetted -> works fine
or he could decide to click on the original value, which was set as default before, in this case the selected value doesn't change but stays the first result from the filter
when now saving the entity behind the form, the original default value is saved
I assume that this happens because when the first result from the filter is set, it just set in the frontend and not in the entity behind the form/ the backend.
Is this a known bug? Do you have any idea how to fix it with a reasonable amount of effort?
I will try to convince my customer to accept this behavior, but I think it's a bit strange, although I admit this is a scenario that's not likely to happen, often. Nevertheless, they found it =)
I am using Primefaces version 5.3.11 (elite version or something like that)

Why we need the optional parameter queryItem in Cognos promptmany

In this page:
http://publib.boulder.ibm.com/infocenter/c8bi/v8r4m0/index.jsp?topic=/com.ibm.swg.im.cognos.ug_fm.8.4.0.doc/ug_fm_id9744using_macro.html
We have:
QueryItem
This parameter is optional. The prompt engine can take advantage of the Prompt Info properties of the query item. Descriptive information can be shown, although the prompt value is a code.
I am having trouble understanding this part :
The prompt engine can take advantage of the Prompt Info properties of the query item. Descriptive information can be shown, although the prompt value is a code.
The promptmany syntax will ultimately generate a where clause. So how can it use the properties of the Query Item?
The prompt generation in the front end uses this parameter, not the query engine. This parameter makes no difference to the where clause. It is basically a hint to the prompt engine to tell the front end when it tries to automatically build a prompt.
I never fill in this parameter when I use prompt macros.

Problem getting value from "Checkbox group value prompt"

I've value prompt with ui:checkbox group
parameter: p_IsLastMonth
Name: Prompt_IsLastMonth
ItemCount: 1; UseValue:Yes, DisplayValue: LastMonth?
and two Date Prompts.
Whenever the checkbox is checked, the UseValue 'Yes' is passed to the parameter 'p_IsLastMonth'. But whenever the checkbox is left as it is, it results in an error.
Element 'selectOptions' is not valid for content model: 'All(style,defaultSelections,conditionalStyles,conditionalRender,XMLAttributes)'
I also tried giving a default value. But the default value has to be in the collection. But i want only one checkbox to be displayed.
I tried with html checkbox. But i'm not able to send the value 'either yes or no' to the parameter through javascript because however the finish button overrides the value.
Any help?
There are 2 ways you can use Parameters:
Evaluate Parameter value
Evaluate expression against Parameter value.
Either way your Parameter has some value, and no value is a kind of value. And you need to cater for empty value in some way. Eg:
If (?Parameter? <>'') then ([Selection Criteria] = 'True') Else (1=1)
OR
([Selection Criteria] = ?Parameter?) OR ?Parameter? = ''
There other ways of using parameters too. You should choose one that better suits situation and coding practices you are following.
You can use optional checkbox or text item. In Cognos 10 I get "Deselect" option under checkbox group.
Unfortunately, I don't think you can accomplish what you want to do with only one checkbox. The only way you can leave a value prompt unselected and still submit the prompt page is to make it "optional", which means no value will be passed. An option is to use two check boxes and make them "required" so that either "yes" or "no" must be selected (but this can result in both being selected, which isn't good), or preferably use a radio list with two values and "yes" as the default. There may be a javascript answer to this, but I try to avoid that as much as possible since it sometimes leaves you open to version upgrade issues. Using a radio list is your easiest option.
Well here is something that will work. I've done advanced scorecarding and dashboarding for years with Cognos and Javascript will work:
Create a real cognos parameter that has both choices you need Yes/No with no being the default. Put them perhaps in a html table somewhere off the main real-estate of the report/param canvas. Once you have the param configed you can make the size as small as you want and then make the table/checkbox invisible by turning the visible property to no. Basically the users won't see these params. Don't do box-type = non or the parameter won't even get generated. You could also wait on hidding them until we get step 3 working(Make it easier to troubleshoot).
Then create a HTML parameter that the user will use to interact with in the style that you want the users to see, and use javascript onchange events to manipulate the real hidden parameter by finding it via DOM model. You can make finding it easier by perhaps surrounding the hidden params with an HTML tag that has a unique name/ID and referencing the child items from there.
Since your cognos parameter is invisible you may not even need to use a check box... you could simply use a hidden text box that has stores Yes/No. This will make your coding simplified on the javascript until you get used to it.
Also When programming with javascript on Cognos i find using alert to echo a object's innerhtml to screen while troubleshooting to be very handy.
* One other less impressive approach if i remember right as well..
1. Leave your original cognos style checkbox alone and create another cognos prompt that is always defaulted to "-NO-" and hidden on the canvas.
2. In the expressions used to evaluate the parameters the would evaulate the concatenation values of both params and you could take logical action based on those values. So if the concatted results were "-No-" then you know the original paramater was not selected and to use "No". etc... I believe there could be a nuance to getting this to evaluate correctly in the expression editors but i have got this owrking before as well. * So i your case if the concatted results first 3 characters = "Yes" the "Yes" otherwise no.

Resources