How do I hide a table that has no data on ireport? - ireport

How do I hide a table (not include in layout) that has no data?

If you have the table on its own band, what I typically do is set a print when condition on the band that only shows the data if any object in that band has data. Say your table is something like this:
item1 item2 item3
The print when expression would look something like this:
item1 != null || item2 != null || item3 != null
If you're referring to a subreport built using a collection, then I just check to make sure the collection isn't empty:
!subreportCollection.isEmpty()
Putting the print when condition on the band line hides the data, and causes the report to collapse the unused space.

Related

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.

Oracle apex filling form from shared component LOV

I have a query written to fetch some concatenated values as a display value, and the ID of a customer as the return value, however, the display value only shows the first part of the display value, and on clicking any of the options, buffering icons appear next to the field and continue infinitely.
SELECT (Customer_ID || ' ' || First_Name || ' ' || Last_name) as display_value,
Customer_ID as return_value
FROM tbl_Customer;
This query works perfectly when run on its own, and I have used something similar for another table, which also works, both in theory and in actual use
SELECT Customer_ID d,
License_Plate r
FROM tbl_Vehicle;
I've tested the original query in as many different ways as I can think of, including making it almost identical to to the formatting/syntax of the second query and the issue still persits.

google sheets query returning returning a row with empty cell even though condition checks for null

I am working on a workflow process in the sheet below
https://docs.google.com/spreadsheets/d/1MS-UydJ9EJ_jOrSwSt1o4Lh6ekGQxpsprFz2RAq6CdI/edit?usp=sharing
I am facing an odd issue. In the DataStudio sheet i have a query which checks the actual and planned columns in the FMS sheet and should not return any results where the planned column is null. In the current sheet it is returning one row where the planned column is blank.
To check this I queried the specific range in FMS in Sheet35 with the query in cell G1
=query({FMS!B8:B,FMS!U8:V},"select * where Col2 is not null")
this is returning a row where Col2 is blank and should not pass the condition is not null. I dont know
if I am missing something very fundamental here as I even as a check tried to set the cell to IFERROR(0/0) which should return a blank and that still shows in the result
try:
=QUERY({FMS!B8:B, FMS!U8:V}, "where Col2 is not null", 0)

Changing a 0 or 1 value to "Yes" and "No" in APEX report

I have a report region on my page and it's getting data from a students table. Within that table, there's a column called cv_lodged which is either 1 or 0 representing Yes or No. In the report it shows this columns data as 0 or 1, I want to change it to show Yes or No.
How can I do this?
You can put a CASE statement in your query
SELECT (CASE WHEN cv_lodged = 1
THEN 'Yes'
ELSE 'No'
END) cv_lodged,
other_columns
FROM students
If this is something that is likely to be common, you're probably better served creating a function that converts your pseudo-boolean data to a string. Something like
CREATE FUNCTION my_bool_to_str( p_num IN NUMBER )
RETURN VARCHAR2
IS
BEGIN
IF( p_num = 1 )
THEN
RETURN 'Yes';
ELSE
RETURN 'No';
END IF;
END;
that you would call in your query
SELECT my_bool_to_str( cv_lodged ) cv_lodged,
other_columns
FROM students
I've usually just created a static LOV in Shared Components called YES1_NO0, with 2 entries: 'Yes' -> 1, 'No' -> 0.
In Interactive Reports you can then change these columns. To do this, edit the column of the IR. Change 'Display Type' to 'Display as Text (based on LOV, escape special characters)'. Then under 'List of Values' set 'Column Filter Type' to 'Use Named List of Values to Filter Exact Match' and select the named LOV.
But sure, you can totally do this in SQL.
Currently, there is a simpler way to do this.
First open the APEX page with the "Yes/No" item as developer and click on the item to open the page item settings.
Change the Settings value from Use component settings to Custom.
Afterwards change the Yes Value to 1 and the No Value to 0.
This solution has some advantages:
No need to decode the value 1 or 0 to Y or N (select decode(mycolumn, 1, 'Y', 'N') from mytable where id = 123;) or select case when ...
No need to decode the submitted value back to 1 or 0 from Y or N

Resources