I have five letters (five pages) in a Cognos report. The letters are in response to NSF checks received by the company . Each letter is different based upon conditions that exist in the NSF file. I need to print those letters based on those condtions. For example -- if the customer I has never had an NSF check. I want to print a nice letter ( page 1). If the customer has had other NSF check then letter 2 ( page 2 ) and so on. I have created the following variable --
IF [Main].[RETURN_REASON_CD] = 'FINAL' Then '1' Else (
IF [Main].[RETURN_REASON_CD] = 'FIRST' AND [Main].[METHOD_OF_DRAFT_OVR] = 'ACHDA' Then '2' Else (
IF [Main].[RETURN_REASON_CD] = 'FIRST' AND [Main].[METHOD_OF_DRAFT_OVR] <> 'ACHDA' Then '3' Else (
IF [Main].[RETURN_REASON_CD] NOT IN( 'FIRST', 'FINAL') AND [Main].[METHOD_OF_DRAFT_OVR] = 'ACHDA' Then '4' Else '5')))
What do I need to specify in values 1,2,3,4,5 to get this to print correctly. Thanks
I suggest you create five boolean variables, then go to the page explorer, click on the Report Pages folder, which will then show you a list of your five pages. Click on each of your pages and set the Render variable.
When the Render variables evaluates to TRUE, your page will be rendered. When it's false it will not.
There is probably a way to do this using one variable as you have done but I can't think of it right now. You might want to look into page sets. Or you could compress all the pages into one page and use a conditional style to hide each piece.
You can use a single page with a conditional block, so you only need one string variable with five different values instead of five boolean variables.
Create one variable that has a case expression like yours...
Case
When Expr 1
Then "Show Page 1"
When Expr 2
Then "Show Page 2"
etc...
else "Show All Pages" or whatever you want to do with your else
End
You need to make sure the literal values are listed exactly as output values on the variable page. This is important.
Start with report page 1 and switch to structure view that way it is easy to navigate up to the Page object. Once your in the page object i believe there is a render variable and/or conditional style depending on your Cognos version. If it is a render variable its easy... you just select that variable that you created and choose which literal values will trigger a render true condition. So if your on Page 1 then you will pick Page 1 as the true condition from the variable and the page will only be rendered when that condition is true.
If there is not a render variable then you will have to navigate to the variable pane after it is created and one at a time choose your output values and that will take you into condition mode (Changes color). When you have say "Page 1" selected in the condition explore you will navigate to Page 1 via the structure view and set visible = property to true and then navigate to all other pages and set them false(You could default all pages to false initially save this step if you want).... You will repeat this exercise for all possible output values. Won't take long but it is more tedious and that is why they created the "Render Variable"
The condition explorer allows you to select a output value and then navigate around in the report and change style visibility properties... those styles/visibility properties will only happen when the variable condition finds that output value true. It is a visual if/case statement basically.
Related
I want to set label value to 'Red' if a group in a report is only on one page, and 'Green' if the group requires 2 or more pages. Is there a way to detect if {field1} (group header text) has continued to the next page or ended on the same page? I have been trying this in the formula editor of the label. No luck yet.
There's a built-in function named "InRepeatedGroupHeader". Combined with the Previous function you could detect wether a group is repeated due to a page break or not. CR function with pseudo column name:
If
InRepeatedGroupHeader
And
Previous({GroupingField}) = {GroupingField}
Then // this group header is repeated due to page break
'yes'
Else // this group header is either not repeated or is repeated due to group change
'no'
This may be of use in your case, though it does not allow detecting "groups filling more than one page" on the page a group starts.
In oracle apex, if the value of Upload Status column is NEW, then the Edit Button icon should be disabled in Interactive Report.
I am aware that some dynamic action has to be added.
The name of my table is intg and it has a column named upload_status. If the value of it is NEW then I should not be able to edit that record.
From my point of view, the simplest option is to disable link column in Interactive Report's attributes and create your own link as part of the select statement. Something like this:
select case when upload_status <> 'NEW' then
'<img src="#IMAGE_PREFIX#ed-item.gif" border="0">'
end as link_icon,
id,
name,
whatever
from your_table;
As the link_icon column contains HTML tags, you'll have to set "Escape special characters" to "No" for this column (otherwise you'll actually see the tags instead of the icon).
Then, in column's properties, set its type to "Link". Edit "Link" section and set it to navigate to another page in this application (you know which one, and which parameters to pass).
That should do it.
I created many option groups in MS Access 2013 and I am trying to populate my table according to what is selected in the option group. So, if the user selects option 1, I want "the text" not its value ex: "1" stored in my table. I tried the following code in AfterUpdate() event and it works fine:
Private Sub Frame49_AfterUpdate()
Dim D As Integer
Select Case Me![Frame49]
Case 1
Me![Name] = "text"
D = 1
Case 2
Me![Name] = "text1"
D = 2
Case 3
Me![Name] = "text2"
D = 3
Case 4
Me![Name] = "text3"
D = 4
Case 5
Me![Name] = "text4"
D = 5
End Select
DoCmd.RunCommand acCmdSaveRecord
Rem D = Frame49.Value
End Sub
but when the end user answers the first question and tries to answer the next question, all options of the previous question get selected. How do I fix this?
Here is the file to see what I mean:
https://drive.google.com/open?id=1WjrAhXCnk961mxBuxS3RYqOUpPA_GsyL
Thanks in advance.
even though the option group only takes numeric values, you can achieve what you want by hard coding the values using if statements e.g
If Frame5 = 1 Then orukolook = "okay"
If Frame5 = 2 Then orukolook = "right"
If Frame5 = 3 Then orukolook = "fine"
orukolook is the textbox control that you want the texts to be inserted, so if the first option of the option group is selected,the text "okay" will be inserted into the textbox control, if second option then the text "right" will be inserted.
The values hard coded in the place holder oruko look,e.g okay,right, fine are the labels associated to each value in the option group.
OptionGroup frame and associated buttons/checkboxes must have a number value. Therefore OptionGroup frame must be bound to a number type field. If you want controls to reflect selection in a text field, then need code to set UNBOUND OptionGroup frame with corresponding number value. In other words, convert saved text back to number value. Code would most likely need to be in form Current event. Something like:
Me.Frame49 = Switch([Name]="text",1, [Name]="text1",2, [Name]="text2",3, [Name]="text3",4, [Name]="text4",5)
Alternatively, save number value to number fields. Text equivalent is provided by labels on form. Use lookup tables to provide text equivalent on reports or calculate the equivalents with expressions in query or textboxes. An expression like:
Choose([Name], "text", "text1", "text2", "text3", "text4")
BTY, Choose() expression can be used in place of Case structure in your original code.
Me![Name] = Choose(Me.Frame49, "text", "text1", "text2", "text3", "text4")
Also recommend using radio (option) buttons instead of checkboxes.
Other alternatives are comboboxes and listboxes instead of option groups.
Advise not to use reserved words as names for anything. Name is a reserved word. Also, avoid spaces and punctuation/special characters in naming convention.
Frame49 is bound to a database field.
When the user clicks a checkbox, the field's value (along with Frame49's value) is set to an integer.
You then change the database field's value to a string.
This causes Frame49's value to be set to that string.
Since that is an invalid value for an Option Group, all the related checkboxes show as a solid black square, representing an indeterminate state. That is not the same as a checkmark, so your observation "all options of the previous question get selected" is incorrect.
The simplest way to do what you want is to use a 1-column ListBox instead of an Option Group. You can size each ListBox so that it shows all the options as text strings.
When the user clicks an "option" to select it, the corresponding text string will be written to the database, with no VBA code involved.
When the user goes back to a previous record, the ListBoxes will all show the proper selections.
If you don't want to change how your form looks, then you must do as others suggested, and make Frame49 unbound, i.e. set its Control Source to blank.
Then when you set the database field's value to a text string, Frame49's value will remain as an integer.
If you want the ability to go back and edit earlier records, you can do it but it is beyond what I can answer here.
Iam using Pentaho report designer and we want to hide a subreport if there is no data .
I have tried to use this formula :
not(isemptydata())
in the visible expression but it does not seem to work .
So how to hide a subreport if no data .
Pentaho Report Designer elements have "attributes" and "style" sections. In style section there is a field "Visible". If you don't want to make the sub-report visible, it must be set to "false".
When want a function to disable it, the expression must return a "FALSE()" value.
You don't specify how the sub-report is generated and where is it placed (Details, Report Footer, etc), but, I'm gonna assume you have defined a function that has the count of rows for a group "TOTAL_ROWS" (and this is gonna be the field you are gonna compare), so, to hide the sub-report when 0 rows are present:
=IF([TOTAL_ROWS] = 0; FALSE(); TRUE())
"if the total number of rows is zero, return false, else return true".
I'm new to SSRS 2012 and have a question about variables. I have a report that retrieves order and order line information from our database (order #, order line #, item, quantity, etc). I need to add a textbox to the footer of the report that can only be displayed for certain items (i.e. if item # equals "123" then show textbox, otherwise hide it.
I added a report variable called 'ItemExists', and unchecked the read-only flag, and set the default value to 0.
I then added an expression to the textbox on the report footer to show it if variable=1, and to hide it if variable=0.
I'm trying to add a textbox with an expression to the body of the report (same group as where the item # is displayed), but I'm unable to get the report variable to update properly. Here's what I tried:
=IIF((Variables!ItemExists.Value = 0) and (Fields!item.Value = "123"), (Variables!ItemExists.SetValue(1)), Nothing)
This works if the value of the item is 123, but if the item is not equal to that value, it still sets the ItemExists variable to 1.
The reason I'm checking to see if the variable is equal to 0 is that there may be multiple lines in the report, and if any one of the items is a match, I want the variable to be set to 1.
I'm not sure if I'm way off track here, but if you could provide any assistance on the best way to achieve this, that would be great.
Thanks in Advance.