Duplicate values being created for same column value in a crosstab - oracle

I am trying to create a crosstab in webi reports that should look something like this:
Use link https://i.stack.imgur.com/0H5ej.png for the image
That is there is a person 'a' occupying a room 'Room1' for a certain date 01/01/2020 and also a person 'b' occupying 'Room2' for the same date. Have a oracle table from where i am fetching the data into the report.
But instead of that it is being displayed as:
Use link 2 for this image
Please help me with this issue.
Thanks in advance! :)

What object represents the values of 'a' and 'b'? Let's say it is Person. Create a variable called MaxPerson defined as follows and use that in place of Person.
MaxPerson=Max([Person])
Does that work for you?

Related

Additional row with empty header in matrix in power bi

The problem is probably trivial but unfortunately I can't figure it out. Here are two basics tables:
I tried to create the matrix based on the selected ID (from the Table2) with values from Table1. I created a measure "% Margin" (margin divided by revenue) and tried to add this to the matrix with ID from Table2. Every time besides ID from Table2 I got one additional row with empty ID. Anyone has an idea how to get rid it off? The rest of the matrix is correct.
Instead of using a separate static table, simply add a new column to you table and use that to filter your data for the report.
Here's how this would look like:

show selected columns of table in QlikView

I am creating a Dashboard in QlikView, allowing the user to extract data based on the filters and selected columns. Requirments are below.
“Data Extract” table MUST be empty (even no column names are showed)at first!
Clicking the blue button shows the list of data available.
A table will then show those selected columns.
Does someone know how to do these?
Screenshot:
You need to set a conditional expression on each of your dimension and measures.
A simple example would be to have an ID for each measure, here the measure "NetSales" can be referenced by MeasureID "a".
Measure | MeasureID
NetSales | a
In the conditional expression for NetSales you can have:
=if(IsNull(GetFieldSelections(Measure)),0,SubStringCount(Concat(MeasureID, '|'), 'a'))
This will check the possible MeasureIDs and return 1 if NetSales is selected.
You need to create a "floating" tables with the dimensions & expressions you need to use in the table object:
Here is an example I made : https://ufile.io/j20am (just reload the file If you use personal edition)

Oracle SQL View takes only columns but not the data

I created this view
SELECT p1.*, p2.*, p3.*, p4.*, p5.*
FROM proizvodi_1_nivo p1,proizvodi_2_nivo p2,proizvodi_3_nivo p3,proizvodi_4_nivo p4,proizvodi_5_nivo p5
WHERE p2.sif_proizvod_1=p1.sifra_proizvoda_1
AND p3.sif_proiz_2=p2.proizvod_nivo_2
AND p4.sif_pro_3=p3.proiz_nivo_3
AND p5.p_sifra_4=nivo_4_proizvod
and when it's created I can see all the columns' names, but it doesn't retrieve any data. I created many other views in this way but I only have problem with this one. Could it be related to constraints?
Thank you for the help.
you know your result will be the Cartesian product right. You need to optimize your query to work efficiently and you need to change this.
p5.p_sifra_4=p4.nivo_4_proizvod from last column. you forgot p4.

Passing more than 3 items in a reports column link

I have a report that is listing students and I want a column to edit a student. I've done so by following this answer:
How do you add an edit button to each row in a report in Oracle APEX?
However, I can only seem to pass 3 items and there's no option to add more. I took a screenshot to explain more:
I need to pass 8 values, how can I do that?
Thanks!
Normally, for this you would only pass the Primary Key columns (here looks like #RECORD_NUMBER# only). The page that you send the person to would then load the form based on the primary key lookup only. If multiple users were using this application, you would want the edit form to always retrieve the current values of the database, not what happened to be on the screen when a particular person ran a certain report.
Change the Target type to URL.
Apex will format what to already have into a URL text field which magically appears between Tem3 and Page Checksum.
All you need to do is to add your new items and values in the appropriate places in the URL.
I found a workaround, at least it was useful to my scenario.
I have an IR page, query returns 4 columns, lets say: ID, DESCRIPTION, SOME_NUMBER,SOME_NUMBER2.
ID NUMBER(9), DESCRIPTION VARCHAR2(30), SOME_NUMBER NUMBER(1), SOME_NUMBER2 NUMBER(3).
What I did was, to setup items this way:
P11_ITEM1-->#ID#
P11_ITEM2-->#DESCRIPTION#
P11_ITEM3-->#SOME_NUMBER##SOME_NUMBER2#
Previous data have been sent to page 11.
In page 11, all items are display only items.
And P11_ITEM3 actually received two concatenated values.
For example, the calling page has columns SOME_NUMER=4 and SOME_NUMBER2=150
so, in pag1 11, P11_ITEM3 shows 4150
In page 11 I created a Before Footer process (pl/sql expression)
to set up new items, for example P11_N1 as source SUBSTR(P11_ITEM3,1,1)
and item P11_N2 as source SUBSTR(P11_ITEM3,2,3)
So, I had those items with corresponding values from the calling IR page.
The reason I did not pass the primary key only for new lookup access, is because i do not want to stress database performing new queries since all data are already loaded into page items. I've been an oracle DBA for twenty years and I know there is no need to re execute queries if you already have the information somewhere else.
These workarounds are not very useful for a product that bills itself as a RAD tool.
Just include a single quoted word in the select statement (Select col1, 'Randomword', col2 from table 1;)
Then define that column as a link and bingo! More items than 3 to select.

VB6 and data-bound MSHFlexGrid, moving and populating columns

I'm working on a VB6 program that connects to a SQL Server 2008 R2 database. In the past I have always used the MSFlexGrid control and populated it manually. Now, however, the guy who is paying me for this wants me to use data-bound grids instead, which forces me to use the MSHFlexGrid control because I'm using ADO and not DAO. So, I have two questions...
First, how would I move a column in a MSHFlexGrid? For example, if I wanted the third column to appear as the sixth column in the grid, is there a simple single line of code that would do that?
Second, believe it or not, I've never had to do anything in a grid other than display the data, as is, from a recordset. Now, however, I have a recordset with some fields that contain just ID numbers that refer to records in other files - for example, a field containing an ID number referring to a record in the Customers table, instead of the field containing the customer's name. What is the easiest way to, instead of having a column showing customer ID numbers from the recordset, having that column show customer names? I thought I read somewhere that there's a way to embed a sql command in a MSHFlexGrid column, but if there is I wouldn't know how to do it. Is this possible, or is there a simpler way to do it?
TIA,
Kevin
The column order would typically be handled by your SELECT statement.
Say you have a Pies table that has a FruitID foreign key related to the FruitID in a Fruits table:
SELECT PieID AS ID, Pie, Fruit FROM Pies LEFT OUTER JOIN Fruits
ON Pies.FruitID = Fruits.FruitID
This returns 3 items: ID, Pie, and Fruit in that order.
Moving columns after the query/display operation is rarely used, but yes ColPosition can be used for that.
Wow! VB6.... Back to the future! :-)
You can move Columns using the ColPosition Property.
This article shows how you could setup the grid to display hierarchical data.
If you just want to display the customer name on the same line as the main data then that is doable as well by just creating the proper SQL for your data source. For that matter you can control the column order the same way as well.
Now, how about considering upgrading to .Net? Just kidding..... No, I'm not. OK. I am, maybe. :-)

Resources