IBM Cognos Analytics - Multiple rows into single row - repeater

I am using Cognos Analytics 11.0.4 and I am trying to concatenate multiple rows into a single row.
ID Department
123456 Front Office
123456 Reception
123456 IT
What I would like to do:
ID Department
123456 Front Office|Reception|IT
I tried creating a repeater with a new query, adding ID, Department to it, then setting up a master detail relationship between query1 ID and query2 ID, finally adding a text item with the | character.
When running the report I only get the below.
ID
123456
Anyone know what might be going wrong? It is like the repeater and | in query2 are ignored for the final output.

I figured it out, as simple as it was, it took me a while to realise.
Exporting my report with the 'Run Excel Data' option couldn't handle the row operations required by the Repeater object.
Switching to 'Run Excel' resolved the issue.

Related

Oracle Apex 22.21 - Chart Page - Bar Type - Datepicker

I have a table ORDERS which contains column ORDER_DATE. I have created a Chart as a Bar type. I want the chart to show the amount of orders in a given date or range.
I'm following this Youtube tutorial which shows how to create a datepicker that returns a range in a Report. I'm trying to replicate this in a chart.
What I've done so far
Created datepicker items P5_DATE_FROM and P5_DATE_TO
Changed the Series Source Type to SQL Query
select ORDER_ID,
ORDER_NUMBER,
TO_CHAR(ORDER_DATE, 'YYYY-MM-DD') AS ORDERDATE,
STORE_ID,
FULL_NAME,
EMAIL,
CITY,
STATE,
ZIP_CODE,
CREDIT_CARD,
ORDER_ITEMS,
APEX$SYNC_STEP_STATIC_ID,
APEX$ROW_SYNC_TIMESTAMP
from ORDERS_LOCAL
where TO_CHAR(ORDER_DATE, 'YYYY-MM-DD') between :P5_DATE_FROM and :P5_DATE_TO
Source Page Items to Submit added P5_DATE_FROM,P5_DATE_TO
I basically followed the exact steps of the video. However, since the video is for a report and mine is for a chart, the chart isn't actually returning any data.
I think this is because for charts there are additional fields I need to configure. I noticed the video didn't cover Column Mapping and I'm a bit confused to what to enter here.
----------------UPDATE-------------
I've followed Koen's instructions from his answer. It seems like to TO_CHAR function was causing the error. I've updated the SQL Query to below:
select ORDER_ID,
ORDER_NUMBER,
ORDER_DATE,
STORE_ID,
FULL_NAME,
EMAIL,
CITY,
STATE,
ZIP_CODE,
CREDIT_CARD,
ORDER_ITEMS,
APEX$SYNC_STEP_STATIC_ID,
APEX$ROW_SYNC_TIMESTAMP
from ORDERS_LOCAL
where ORDER_DATE between TO_DATE(:P5_DATE_FROM,'YYYY-MM-DD') and TO_DATE(:P5_DATE_TO,'YYYY-MM-DD')
However, on the Page Designer I cannot save and run page until I select Column Mapping - Label and Value. I've set the Label as ORDER_DATE but I am unsure of what to select for the Value.
Setting the Value to ORDER_DATE shows an error Ajax call returned server error ORA-01403: no data found for CHART Count Orders by Date.
and selecting any other Value such as ORDER_NUMBER or ZIP_CODE populates the chart with the actual integer value of the column (ex: ZIP_CODE returns a chart of x-axis: date, y-axis: actual zip code numbers)
I see 2 possible issues.
You submit P5_DATE_FROM and P5_DATE_TO but the source has P1_DATE_FROM and P1_DATE_TO - not sure that is a typo but it should all be the same...
The where clause is wrong. This
from ORDERS_LOCAL
where TO_CHAR(ORDER_DATE, 'MM-DD-YYYY') between :P1_DATE_FROM and :P1_DATE_TO
should be
from ORDERS_LOCAL
where ORDER_DATE between TO_DATE(:P1_DATE_FROM,'MM-DD-YYYY') and TO_DATE(:P1_DATE_TO,'MM-DD-YYYY')
Reason: the column orders_local.order_date is of datatype DATE. If you convert it to a string using TO_CHAR then it will be a string comparison, not a date comparison.
Note that bind variables P1_DATE_FROM and P1_DATE_TO are strings - they're defined in the DOM on the html page and that has no concept of oracle datatypes so everything is just a string. If they're used as such in a date comparison, you're relying on implicit conversion by the database. It's safer to do explicit conversion using the TO_DATE function.
--UPDATE--
Your question starts with "I want the chart to show the amount of orders in a given date or range.". Well... there is your answer. The "Value" is the amount of orders on each day. Update your source query to include a count of the orders and group by day. Then make your value attribute the column that has the count.

Oracle Apex 22.21 - Chart Page - Bar Type - Datepicker - How to update the source query to include a count and group by day

This question is a follow up to another SO question
I want a bar chart to show the amount of orders in a given date or range. Koen's updated answer shows:
'The "Value" is the amount of orders on each day. Update your source query to include a count of the orders and group by day. Then make your value attribute the column that has the count.'
How would I go about doing this?
Summary: I have a table ORDERS which contains column ORDER_DATE. I have created a Chart as a Bar type. I want the chart to show the amount of orders in a given date or range.
I'm following this Youtube tutorial which shows how to create a datepicker that returns a range in a Report. I'm trying to replicate this in a chart.
What I've done so far
Created datepicker items P5_DATE_FROM and P5_DATE_TO
Changed the Series Source Type to SQL Query
select ORDER_ID,
ORDER_NUMBER,
ORDER_DATE,
STORE_ID,
FULL_NAME,
EMAIL,
CITY,
STATE,
ZIP_CODE,
CREDIT_CARD,
ORDER_ITEMS,
APEX$SYNC_STEP_STATIC_ID,
APEX$ROW_SYNC_TIMESTAMP
from ORDERS_LOCAL
where ORDER_DATE between TO_DATE(:P5_DATE_FROM,'YYYY-MM-DD') and TO_DATE(:P5_DATE_TO,'YYYY-MM-DD')
Source Page Items to Submit added P5_DATE_FROM,P5_DATE_TO
I basically followed the exact steps of the video.
However, on the Page Designer I cannot save and run page until I select Column Mapping - Label and Value. I've set the Label as ORDER_DATE but I am unsure of what to select for the Value.
Setting the Value to ORDER_DATE shows an error Ajax call returned server error ORA-01403: no data found for CHART Count Orders by Date.
and selecting any other Value such as ORDER_NUMBER or ZIP_CODE populates the chart with the actual integer value of the column (ex: ZIP_CODE returns a chart of x-axis: date, y-axis: actual zip code numbers)
-----------UPDATE----------
Per Koen's answer, I've updated the Source SQL Query to below but I am now receiving an error.
And if I copy the exact query that Koen suggested, I run into below:
I did some messing around and found if I include APEX$SYNC_STEP_STATIC_ID and APEX$ROW_SYNC_TIMESTAMP the missing expression error goes away but instead I receive the GROUP BY error.
Something like this (untested) should work. Use TRUNC to ensure all orders on the same date are grouped (since date has a time portion, you'd have a different column for each different date time. Use ORDER_DATE as label and ORDER_COUNT as value.
select COUNT(ORDER_ID) AS ORDER_COUNT,
TRUNC(ORDER_DATE) AS ORDER_DATE,
from ORDERS_LOCAL
where ORDER_DATE between TO_DATE(:P5_DATE_FROM,'YYYY-MM-DD') and TO_DATE(:P5_DATE_TO,'YYYY-MM-DD')
GROUP BY TRUNC(ORDER_DATE)

Concatenate rows based on user selection

I have a table like this:
Ticket Number
Client
Type
T123
Andy
Question
T456
Bob
Issue
T789
Charlie
Problem
I use the filters to display which tickets I am interested in, then open Excel and use
= "www.myticket.url/" & TEXTJOIN("&",TRUE,A:A)
in order to open the url to display all my tickets (in this case, www.myticket.url/T123&T456&T789)
Is there a way to display this dynamically created URL directly in Power BI rather than having to download to Excel?
You can create a measure using CONCATENATEX DAX function to concatenate the values in Ticket Number column, with & separator.
The measure could look like this (where Table is the name of the table):
URL = "http://www.myticket.url/" & CONCATENATEX('Table', [Ticket Number], "&")
Probably you will also want to set the data category of the measure to Web URL.

How to filter cards based on table data row selection in Power BI?

I am working on a report that deals in employee feedbacks. I have different cards on top to show -
(Requests Received,Type of requests(social/others/security),Requests reported/not reported and expired).
All these cards have data based on a measure - Count of Employee IDs = count('vw_EmployeeFeedback'[Employee_Id]) + 0 and respective filter fields dragged on to them to show category type etc.
Below them I have a table to show the detailed view of the data. Such as names of manager raising the request, Request raised for(name field) , status of requests, submitted date etc. coming from the same view as Count of Employee Ids.
I want the cards to filter based on the selection of a row in the table.
The edit interaction are set to filter the cards, but all go zero or blank when I select a row in the table.
Please let me know how I can achieve this. Thank You!
I am assuming that you have different tables for your data source/s that is why it is not filtering when clicking the table entry. Try establishing the relationships of your tables. Just go to Models and then Manage Relationships. If it's not the case, then you need other solutions.

Apex5.0 choose layout and add date validation

I am building a student module application in Oracle Apex 5.0 and wanted to know how to display the details in oracle apex.
Something like this with two tabs on the 1 page:
on first tab, When input StudentID,
the first section will contain system_date and tutor name that has login
second section should contain student name and course desc & course year
third section is to display current semester module, if payment done or not (Y /N), markings %, date of payment.
2nd tab of the page to include all courses done for that student.
Which layout to choose (interactive grid/report) or any other.
How to add validation of date picker for the payment date so that upon input it insert directly in table in DD-MON-YY format and also that it takes system_date??
Note table:
student_details: the student name, address and personal details
course_detail table contains the courses for the semester
payment_detail table for the payment details
The sort of things you're going to want to look for are:
Region Display selector, for multiple tabs
Any type of report region to display data, and you can have multiple, and nest them as sub-regions.
You can define page items that are displayed as date pickers, and use default values to source today's date using the keyword SYSDATE.
You're going to need to understand SQL.