Populating Birt through columns - birt

I have been trying to come up with a birt report to print food tag to no avail. What i want to show on the report is:
foodtag1 | foodtag2 | foodtag3
foodtag4 | foodtag5 | foodtag6
foodtag7 | foodtag8 | foodtag9
Can this be done?
the data is taken from a MySql Query "select dishes.name
from dishes
where find_in_set (dishes.id,(select orders.dishes from orders where orders.id = ))"
** Note: FoodTags 1-9 are all unique name of dishes
** Also note that foodtag 1-9 are representatives of a dish name. FoodTag1 can be "Yang Zhou Fried Rice", it can be "italian Pasta". it can be "Mee Goreng". Data is taken out from a datasource in MYSQL server

The easiest way--
Drag a grid element to your report, set it at 3 columns and 3 rows
In property editor, bind the grid to the data set
Drag a dynamic text element to the first cell in the grid
Then use JavaScript simular to this to filter to the desired text.
if (row["FoodTagColumn"]=='foodtag1'){
row["FoodTagColumn"]
}else null

Related

Creating dynamic data validation

Given the following dataset in one sheet, let's say 'Product Types' (columns and headers displayed):
| A | B | C |
| :----------: | :------: | :-----: |
| Product Type | Desktops | Laptops |
| Desktops | Dell | Dell |
| Laptops | HP | Apple |
In another sheet, let's say 'Assets', I've set column A to require a match to the data validation of an item listed in column A of 'Product Types' (not including the header). What I'm trying to do is that once column A is selected in 'Assets', I'd like to create a dynamic query data validation that will then present the values of the column with the header in 'Product Types'.
As an example, in the 'Assets' sheet, if column A has "Laptops" selected, column B will use data validation for values under the "Laptops" column in 'Product Types'; then giving the only options as "Dell" or "Apple". Alternatively, if ColA is changed to "Desktops", data validation is defined to only allow "Dell" or "HP" as options.
I'm unsure if this is possible. However, data validation in Google Sheets claims to allow a range or "formula".
I don't remember where I sourced this formula from, but it can present the values I need when running the query within a cell. However, I'm unable to use the same formula within a data validation field.
=ARRAYFORMULA(IFERROR(VLOOKUP(A2, TRANSPOSE({'Product Types'!A1:M1;
REGEXREPLACE(TRIM(QUERY(IF('Product Types'!A2:M<>"", 'Product Types'!A2:M&",", )
,,999^99)), ",$", )}), 2, 0)))
The above query presents the correct comma-separated values of the column I want in 'Product Types', but I'm not sure if this can be translated into something data validation can use or if there's altogether a different method to accomplish this.
P.S. I'm new. Markdown for the table seems to work when editing, but not when published..
the answer is no. data validation does not support direct input of complex formulae. you will need to run your formula in some column and then reference the range of that column within the data validation

Google Sheets - Dropdown filter

I want to have an in-cell dropdown list that can filter content in a Google Sheet. For example:
Name | Info | Category ▼
------------------------
Bob | Lorem| A
------------------------
Alice| Ipsum| B
------------------------
What I want to achieve: when I click the triangle, a dropdown appears with options A and B, and if I select A, the content of the sheet is filtered so that I am only seeing the row with Bob.
I also want to do this in place (I was trying with QUERY but I couldn't find a way to output the result in place).

Spotfire: Using one selection as a range for another datatable

I've searched quite a bit for this and can't find a good solution anywhere to what seems to me like a normal problem for this product.
I've got a data table (in memory) that is from a rollup table(call it 'Ranges'). Basically like so:
id | name | f1 | f2 | totals
0 | Channel1 | 450 | 680 | 51
1 | Channel2 | 890 | 990 | 220
...and so on
Which creates a bar chart with Name on the X and Totals on the Y.
I have another table that is an external link to a large (500M+ rows) table. That table (call it 'Actuals') has a column ('Fc') that can fit inside the F1 and F2 values of Ranges.
I need a way for Spotfire Analyst (v7.x) to use the selection of the the bar chart for Ranges to trigger this select statement:
SELECT * FROM Actuals WHERE Actuals.Fc between [Ranges].[F1] AND [Ranges].[F2]
But there aren't any relationships (Foreign keys) between the two data sources, one is in memory (Ranges) and the other is dynamic loaded.
TLDR: How do I use the selected rows from one visualization as a filter expression for another visualization's data?
My choice for the workaround:
Add a button which says 'Load Selected Data'
This will run the following code, which will store the values of F1 and F2 in a Document Property, which you can then use to filter your Dynamically Loaded table and trigger a refresh (either with the refresh code or by setting it to load automatically).
rowIndexSet=Document.ActiveMarkingSelectionReference.GetSelection(Document.Data.Tables["IL_Ranges"]).AsIndexSet()
if rowIndexSet.IsEmpty != True:
Document.Properties["udF1"] = Document.Data.Tables["IL_Ranges"].Columns["F1"].RowValues.GetFormattedValue(rowIndexSet.First)
Document.Properties["udF2"] = Document.Data.Tables["IL_Ranges"].Columns["F2"].RowValues.GetFormattedValue(rowIndexSet.First)
if Document.Data.Tables.Contains("IL_Actuals")==True:
myTable=Document.Data.Tables["IL_Actuals"]
if myTable.IsRefreshable and myTable.NeedsRefresh:
myTable.Refresh()
This is currently operating on the assumption that you will not allow your user to view multiple ranges at a time, and simply shows the first one selected.
If you DO want to allow them to view multiple ranges, you can run a cursor through your IL_Ranges table to either get the Min and Max for each value, and limit the Actuals between the min and max, or you can create a string that will essentially say 'Fc between 450 and 680 or Fc between 890 and 990', pass that through to a stored procedure as a string, which will execute the quasi-dynamic statement, and grab the resulting dataset.

XPages ratio between 2 column totals in view

I have a view with 2 columns. Both number types. I want to add a button to the page, which will calculate the ration between total of column 1 and total of column 2.
For example:
Column 1 | Column 2
5 | 5
10 | 10
4 | 3
3 | 4
It should be (5+10+4+3)/(5+10+3+4) = 1..
Thank you,
Florin
I would probably go into the view properties and turn on the totals for both those columns. Then in SSJS I'd get a NotesNavigator for that view and then create a NotesViewEntry object. Then I'd set that ViewEntry to the NotesNavigator.getLastEntry()... something like that. That entry should then have a columnValues() property. I THINK it would be something like:
var column1 = entry.getColumnValues()[1];
var column2 = entry.getColumnValues()[2];
Note: getColumnValues() is zero based and depending on the view design some columns might not be available to retrieve from getColumnValues().
Once you have you're 2 var's then you can do the math and do whatever with the result.
That's how I would approach it at least.
(I don't have an editor handy so sorry if some of the syntax is off)

Rdlc - calculate sum of columns and display total in a single cell conditionally

Here is the scenario, I have a dataset with fields Category, Country and NUM_SCHOOLS.
i created a column to populate the country names as columns. I created a row group to calculate the row column. In my current report Column headers(Country) Country1, Country2....so on are displayed and row headers(Category) A, B, C and D are displayed. Values is [Sum(Fields!NUM_SCHOOLS.Value)]. Everything is correctly displayed
I used pipe(|) symbol as the separator between the cells, i am not allowed to post images, i tried my best to explain. Please let me know if you need any information to help me.
Current Report:
Country1 Country2
A 10 | 12
B 5 | 6
C 5 | 7
D 11 | 15
Required report:
Country1 Country2
A 10 | 12
B 5 | 6
C 5 | 7
D 26
Only for D column, i want to add the numbers and display the value as a single value. (11+15=26), for other categories it should display in different country buckets.
Please help me out. Thanks in Advance!
Sum of more than One Columns Quantity of More than one dataset in rdlc.=Sum(Fields!QUANTITY.Value, "Tone")
+Sum(Fields!QUANTITY.Value, "Buffalo")
+Sum(Fields!QUANTITY.Value, "Cow")
Sorry to be the bearer of bad news, but I don't think that you can merge columns across column groups.
I think that the best option is to remove your column grouping and manually add in 7 columns for your receipt frequencies. You'd have to use a Sum with an Iif to get your values correctly, for instance in the far left column, something like:
=Sum(iif(fields!RECIEPT_FREQUENCY.Value="ANNUAL" ,Fields!val.Value,0))
then you could add a merged cell underneath and add the following expression
=Sum(iif(Fields!PART_COUNT.Value="D", Fields!val.Value,0),"DataSetName")
Alternatively, you could leave it as it is and enter the following expression in a total row at the bottom of your matrix. But you would have to do something expression based for the cell borders to give the illusion of it being merged..
=Sum(iif(Fields!PART_COUNT.Value="D"
And fields!RECIEPT_FREQUENCY.Value="BI-WEEKLY"
,Fields!val.Value,0),"DataSetName")

Resources