How to know the number of results of a Table-Group? - birt

There is a Table in a report , then I inserted a Group within it. Then I added a footer row within the Table. I want to hide this row if the Group has just 1 row result. So how to know the number of results of the Group ?

Select the table -> binding tab -> Add aggregation
Select "count" as function, select any field as expression and set "aggregate on" to the group. Then use this new binding in visibility expression of the footer row.

Related

Select 2nd Element of a Table using Xpath

How can I select the text field (which is in 2nd column of the table)On binance Top Gainers page
when I search using this query, it will select the first row
(//*[contains(#data-type, 'table-td')])[1]
and same for 2nd row
(//*[contains(#data-type, 'table-td')])[2]
I need to select the 2nd element of this table using xpath (only the text field) (RIF and STX) in this case.
Top Gainers Table on Binance
Or is there a way to get only the text for first and 2nd row
It gave me only the table row.. I need to select the 2nd element of the table.
One way to do this could be :
//div[text()="Top Gainers"]/ancestor::div[2]//div[#class][./img]/div[#title]/#title
or
//div[text()="Top Gainers"]/ancestor::div[2]//div[#class][./img]/div[#title]/text()
Output : 10 items
URL used : https://www.binance.com/en/markets/overview/topmovers

Filter for many columns with dynamic data

I need a help.
I am using Tableau for visualisation. Data in my DataBase are structured by unique keys (+1k rows). I need to filtered value from rows by 2 and more columns (2columns+_filter). And this filtered data must be react to other Filters ("category") on My_Dashboard.
What I used:
Combination from Parameter and Calculation Field.
Parameter - includes data from 2 and more columns (I added it manualy).
Calculation Field - based on Contains(Column1, Parameter) OR... to the last column.
But it doesnot work, because Parameter included data what could be excluded by Filters on My_Dashboard.
Is it possible make a "dynamic filter" what will be select data (rows what inludes "value_1" from range column_1-column_3 after applying Filter - "category1" only.
For example - Input:
rows
column_1
column_2
column_3
column_4
row_key_1
value_1
value_5
category_1
row_key_2
value5
value_1
category_2
row_key_3
value_5
category_1
Output:
rows
column_1
column_4
row_key_1
value_1
category_1
Mayth be it possible with SQL addon/plugin, or something other.
Thanks for your help.
I understood how can realise what I want. If you have the same task, what you need:
add two DataBase (or sheets from excel, etc.) and connect them with unique key "first_db_key = second_db_key";
first DataBase sctuctured by horizontal, 1 row with unique key and a lot of columns with value;
second DataBase sctuctured by our target column (included all possible values waht we need) and ofcourse rows with "unique key" from "first DataBase" could be repeated (2 or more).
on you Sheet need to add filter based on "target column" from "second DataBase", after that, add filter to the "Context" and choose "All using this data source" option on "Apply to Worksheets" in context menu (rigth button click on the filter)
on you Dashboard select to show filter what you added before, and in filter menu choose "All Values in Context" option.
Finaly you are get result what you want.

BIRT allow user to dynamically select report's columns

I want to add an option for the user when creating the report to select the columns that the report will show. See the attached image below on how it is suppose to look.
Is there a way to do that?
I don't know about the parameter dialog, but assuming that your column names are in an array.
You can have an SQL query with all possible column names
(probably you should use special comments to mark the beginning and end of the select list).
E.g.
select
'X' as dummy
-- BEGIN COLS
, column1
, column2
...
-- END COLS
from ...
where ...
order by ...
Then, in the beforeOpen event of the query, you can access and modify the query with this.queryText (IIRC) and remove all those lines ("," + columnname) in the marked part for which columnname is not contained in the array.

How can I create a select list without specifying its List of Values?

I have a form which has two select lists. The first one is prepopulated with an SQL query and has a dynamic action to set the value of the second list based on what is selected in the first.
I tested this out with a select list-textbox combination and it works just fine. However when I try to change the textbox into a select list then I am forced to also provide a "list of values" which overwrites my dynamic action.
How can I create a select list without specifying its List of Values?
Some clarification about my situation.
I have 2 tables: Wines and Winegroups.
+---------+------------+
| Wines | Winegroups |
+---------+------------+
| WineID | GroupID |
| Name | Name |
| GroupID | |
+---------+------------+
In APEX I have a form like this:
When the page is loaded, the first select list will get filled with values using this query:
select distinct Name, GroupID from Winegroups
Furthermore there is a dynamic action defined like this which fires whenever a group is selected. This is supposed to change the values inside the 'Wines' select list.
Event: Change
Selection type: Items on P5_GROUPID
Action: Set value
Page items to submit: P5_GROUPID
Affected elements: Items on P5_NAME
select distinct Wines.Name, Wines.WineID id
from Wines
left join Winegroups
on Wines.GroupID = Winegroups.GroupID
where Winegroups.Name = :P5_GROUPID
order by 1
The second select list uses the same query. When I execute my program the first select list is filled with groups nicely but the second one never gets any values.
Starting in apex 4.1, it is no longer necessary to use a dynamic action to get one select list to populate based on the value selected in a prior one. To get the functionality you want, you should be able to just do:
Disable or remove the current dynamic action.
Go into the Wines select list page item (P5_NAME).
In the List of Values section, for the Cascading LOV Parent Items field, select the winegroup select list item (P5_GROUPID).
The Page Items to Submit field will appear in that same section. Select the P5_GROUPID there as well.
In the list of values definition, put your query just as you wrote it above:
select distinct Wines.Name, Wines.WineID id
from Wines
left join Winegroups
on Wines.GroupID = Winegroups.GroupID
where Winegroups.Name = :P5_GROUPID
order by 1;
Edit to answer to question in comments:
When you do:
select distinct Name, GroupID
from Winegroups;
for a select list it displays name to the user, but stores the groupid. If you wanted to use name, you could do:
select name d, name r
from winegroups;
as your winegoup select list query. Then the value in P5_GROUPID would actually be the name and you could join it to winegroups.name in the wines select list query. Of course you should also rename P5_GROUPID if you were going to do this.
But I would probably just leave it the way it is. This way you actually don't need the join in your second query. You could just make it:
select wines.name, wines.wineid
from wines where groupid = :P5_GROUP_ID.
This would be the cleanest implementation.

Update One table Column with Values from Another table Having Similar

Hi Guys I have Two tables (MIGADM.CORPMISCELLANEOUSINFO and CRMUSER.PREFERENCES) and Each Has a field called PREFERENCE_ID and ORGKEY. I want to Update the Preference ID for MIGADM.CORPMISCELLANEOUSINFO with Preference_ID from CRMUSER.PREFERENCES for Each Corresponding ORGKEY. SO I wrote this Query;
update migadm.CORPMISCELLANEOUSINFO s set s.PREFERENCE_ID = (
select e.PREFERENCE_ID from crmuser.preferences e where s.ORGKEY = e.ORGKEY)
But I get:
ORA-01427: single-row subquery returns more than one row
What Should I do?
It means the columns you have selected are not unique enough to identify one row in your source table. Your first step would be to identify those columns.
To see the set of rows that have this problem, run this query.
select e.origkey,
count(*)
from crmuser.preferences e
group by e.origkey
having count(*) > 1
eg : for origkey of 2, let's say there are two rows in the preferences table.
orig_key PREFERENCE_ID
2 202
2 201
Oracle is not sure which of these should be used to update the preference_id column in CORPMISCELLANEOUSINFO
identify the row where the subquery returns more than one row (You could use REJECT ERROR clause to do it for instance) or use the condition 'where rownum = 1'.

Resources