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.
Related
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.
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.
I am trying to implement automatic phone number formatting into NetSuite I am having some issues getting my script to work. Basically if someone enters a phone number into a customer record, "1234567890" for example, it will automatically format to "(123) 456-7890". You can see my script below along with the error message I receive when creating a new script record.
Fail to evaluate script:
{"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"missing ; before statement (SS_SCRIPT_FOR_METADATA#21)","stack":[]}
Why do you need a script for this? NetSuite already does this, based on the Phone Number Format setting at Setup > Company General Preferences. Check you have this field set correctly according to your preference.
If for whatever reason it turns out you do need a script for this, there are several issues with the script you posted:
There is a syntax error - mismatched parentheses/braces. Your code editor is trying to show you that with the red brace on line 8 and the red squiggly underline on the last parenthesis (line 23).
NetSuite record level client scripts must implement an entry point function. For formatting phone numbers this would be a fieldChanged() entry point. You would need to wrap the logic contained in lines 10 to 20 inside a function, and then reference that in the return statement at the bottom. EG: If you called the function phone() your return statement would be return {fieldChanged: phone}.
You are using SuiteScript 1.0 API functions (nlapiGetRecordId() and nlapiLoadRecord()) in a SuiteScript 2.0 script. Under some circumstances these functions may be available so it might work, but even if it does, it certainly isn't best practice.
Loading the record isn't necessary. When you implement an entry point function, the function is passed a context parameter. IE: function fieldChanged(context). That context parameter contains a reference to the current record (context.currentRecord). Work with that instead of attempting to load the record separately.
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.
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.