Multiselection in prompt using contains operator - multi-select

We have a column in cognos which has the comma delimited values like (AIX1, AIX2,AIX3) in each rows. We want to multiselect the results where say AIX2,AIX3 contained. How do I do it in cognos.

On your prompt page create a drop-down prompt. Click it to edit the properties on the left side, and make it Multiselect->True. Then, inside your report query, filter on [DataItem] in ?PromptName?.

Related

How can I Filter Data in Google Data Studio based on containing 2 or more input options?

I'm building a dashboard for a dataset that includes a Location column, and I would like the user to be able to filter based on location. The trouble is that some projects are happening in multiple locations, so that the column is comma separated list of locations, making the normal dropdown filter option cumbersome ("NY, Paris" and "Paris, NY" are treated as different values). While this can be overcome by adding a parameter dropdown box and allowing the user to select an option (say Paris) and then using a Contains function to filter the output, the Parameter drop down box only allows 1 selection to be made. So a search for all project happening in either Paris or New York seems like it would have to be done using 2 separate parameters. Is anyone aware of an elegant workaround for this that will allow multiple selections of locations within a single dropdown.
The inelegant solutions I've come up with are:
Use n parameter boxes and cap the locations that can be filtered in a single view at n.
Have users input a comma separated list as a parameter, parse that for locations and then show all REGEXP CONTAINS matches of that provided list.
Example dataset showing multiple locations per project in the locations column:
Edited to add a link to a sample report here. The problem, in a nutshell is that I would like people to be able to select 2 or more location parameters so that they don't have to limit themselves to viewing 1 location at a time.
One way to filter CSVs (Comma Separated Values) is by using the CSV Filter Control Community Visualisation (click on the icon on the toolbar and select to view all):
Data Tab
Column to filter on: Location
Cross-filtering: Select (☑) (this ensures that the CSV Filter Control filters other charts based on the value(s) selected)
Style Tab
OR instead of AND behaviour: Select (☑)
Editable Google Data Studio Report (Embedded Google Sheets Data Source) and a GIF to elaborate:

Set Value to a Report Textbox from a Query

I made a query that only shows me a single field and a single record from another query, how can I put that value in a textbox in a report?
The record I want to set is a date that I insert with a MsgBox.
I read that there are ways to just put in the Control Source "=[table]![field]" but I get the Name? error, another way I read but did not understand it is defining a recordset. I can't put the value to the textbox despite trying the ways I've read in other posts.
One simple way is with DLookup() domain aggregate function expression in textbox. If field name has space or punctuation/special characters or is a reserved word, [ ] delimiters will be required. Usually table/query name does not but can't hurt.
=DLookup("[fieldname]","[tableORquery name]")

How to display all records in query when using a criteria

I have created a query and i have a field called Department. I have added a criteria to that field that allows user interface, when you run the query it asks for you to enter the department name you want to display. If I choose to display all departments records what can I put in to display all departments? I remember something about entering * to display all records but this does not want to work
* only works with text fields and even then only when used with LIKE not =.
This is what I would use as filter:
[Department]=IIF([MyParameter]='',[Department],[MyParameter])
This should evaluate to always true when the Parameter is left empty.

How to navigate between two different tables in VB.NET (Access database)

In my VB.Net program I need to add the table "order" and "line of order".
If the first order is selected, I can only navigate the line(s) of order that is linked to the first order. I have no_order in my "line of order" table, so if it's the the first order, I need to only be able to navigate between the line of order with the value "1" in no_order.
In my program I already have the table "product" that I can navigate, delete, add, and modify. How much more complicated is this, or different to do what I just mentioned above? How should I go about doing this? I'm not sure where to start. Would it help if I posted my code from the "product" table?
Thanks.
If you are selecting orders from a dropdown and want lines of order on the same form then you should try this.
Bind the order dropdown on formLoad or PageLoad and set enable=false to 2nd dropdown (i.e of lines of code)
Bind the 2nd dropdown on 1st dropdown's selectedIndexChanged event with the query something like this.
/* ConnectionObject, CommandObject and all that */
select * from LinesofCode where no_order=#no_order
cmd.parameter.addwithValue("no_order",dropdown1st.selectedValue);

DLookUp behavior in Form_Current with Label Captions

Access 2010 here.
Ok, Dlookups appear behave different based on where they are used. I have this Dlookup
inside a ClockNo_AferUpdate() subroutine that works well on new form entries to change a label's caption to what is found in the "Employees" DB under "EmployeeName" field based on the entered "ClockNo" in a ClockNo combo-box:
Me.LabelName1.Caption = DLookup("[EmployeeName]", "Employees", "[ClockNo] =" & Forms![InspectionEntryForm]!ClockNo)
The Employees database has four fields: AutoNumber-type "ID," Number-type "ClockNo," Text-type "Shift," and Text-type "EmployeeName."
Re-EDIT:
The RowSource for the ClockNo combo box as it sources from the Employees database:
SELECT DISTINCTROW [ClockNo], [EmployeeName] FROM [Employees] ORDER BY [ClockNo];
END Re-EDIT
What I am looking for is the same functionality in Form_Current() so browsing through older entries preserves the Label's caption based on the entered ClockNo. Unfortunately, simply re-using the above Dlookup gives a "Run-time error '3075': Syntax error (missing operator) in query expression '[ClockNo] ='."
Attaching the Dlookup as a control source to a text box does work O.K, but labels seem to be the best use here. I have mucked about with the Criteria section of the Dloopkup for some time without any real success.
End goal is to have a simple label next to a combo box that displays the employee's name based on their current and past ClockNo entries. The name is stored in a separate Employees database alongside their clock number and their shift.
This should be quite simple as both the ClockNo entry and the Label operate on the same form with the same database. Thanks for your input!
You have a combo box named ClockNo with this as its Row Source:
SELECT DISTINCTROW [ClockNo], [EmployeeName]
FROM [Employees]
ORDER BY [ClockNo];
I'm not sure why you want DISTINCTROW there. I would have suspected DISTINCT to be more appropriate. But I don't think it matters.
The important point is that the combo already includes [EmployeeName], so you shouldn't need to use DLookup to fetch [EmployeeName] again. Simply read the value from the second column of the combo's selected row.
Imagine your form includes a text box named txtEmployeeName. In the form's current event, you could do this:
Me.txtEmployeeName = Me.ClockNo.Column(1)
Notice the column index numbers start with 0, so the second column is .Column(1).
And you could do the same thing in the combo's After Update event.
Finally, you wanted to change a label's .Caption, but I showed you how to change a text box's .Value. If you can't make this technique work with the label, just use a text box instead. You can set the text box's Enabled property to No and adjust its other properties so that it is visually indistinguishable from a label.
Another approach could be simpler still. If you want to keep [ClockNo] as the combo's bound value, but are willing to display [EmployeeName] as the combo's selected value, you can set the width of the first column ([ClockNo]) to zero. You would still see both [ClockNo] and [EmployeeName] in the dropdown. If this is acceptable, you wouldn't need to bother with a label or text box.

Resources