Delphi FastReports - How to change Rows? - delphi

Delphi Tokyo, FastReports V5. I have a report that I cannot seem to get correct. The report is showing information for 1 sales rep. It contains two Master Data bands and 1 detail data band. Within Delphi, the pseudo code looks like this:
For each sales rep in table
Get Rep ID
Filter ActiveOrders DataSource based on rep ID
Load report definition
Execute report
Export Report to PDF
Next Sales Rep
This works fine for a simple report, such as one that only has a single MasterData band. My report is a little more complex. Specifically, it has two MasterData bands, which are only slightly related. The first band works fine with the pseudo code above. The second band is ONLY a graph. The graph has 4 datasources, because each datasource is tied to a series (aka each datasource adds a different line to the graph). I cannot figure out how to handle the coordination of the data.
My report looks like this.
As an example... the rep is Bob. Bob has 6 active orders, which shows up fine in the top MasterData band, as 6 rows of data. Of those 6 active orders, there are 3 separate companies. I want a graph of each company (in MasterData2). Below each graph, I want detailed data about the orders for that company. I want this to show up as
Graph of Company 1
Details of Company 1
Graph of Company 2
Details of Company 2
Graph of Company 3
Details of Company 3
I can write the queries to get the correct data. I just can't figure out HOW to coordinate the data changing. Since the MasterData2 is a graph, I can't return the data for all 3 companies, or FastReports will try to graph all the rows. How do I tell MasterData2 WHICH data to look at, and how do I tell it that there are more companies to graph (aka another Master/Detail) set to process?

Related

How to generate a distribution based bar chart on row_numbers

I have a SQL query that acts as a data source in my tableau desktop:
SELECT
row_number() over (order by sales) as rn,
article_number,
country,
SUM(sold_items) as si,
SUM(sales) as sales
FROM data.sales
WHERE sales.order_date between '2021-01-01' and '2021-12-31'
GROUP BY 2, 3
On tableau I dragged rn to column and sales to row to generate a bar chart. The following is the output:
I want to convert this into a 0-100% distribution chart so that I can get the following result:
How can I achieve this? Also, I want the user to filter by country level so even if the # of records increase or decrease, the distribution should always be consistent with the filtered data.
You can do this with nested table calcs.
For example, the following uses the Superstore sample data set, and then first computes a running total of SUM(Sales) per day, then converts that to a percent of total. Notice the edit table calc dialog box - applying two back to back calculations in this case.
The x-axis in this example is Order-Date, and in your question, the the x-axis is a percentage somehow - so its not exactly what you requested but still shows that table calcs are an easy way to do these types of operations.
Also, realize you can just connect to the sales table directly, the custom sql isn’t adding any value, and in fact can defeat query optimizations that Tableau normally makes.
The tableau help docs explains table calculations. Pay attention to the discussion on partitioning and addressing.

Google Datastudio show empty row combinations

I am creating a Google Data Studio report for a car dealership and I have a problem.
I have made these 3 screenshots to illustrate:
If you see on the first screenshot, the datasource is pretty simple, used/new indicates weather the car being sold is new or used and if it is a sportscar or family car, and exchange/clean deal indicates weather the dealership takes/buys the customers old car in for a trade off in price. The rest should be self explanatory.
On screenshot2-3 you see my report, I have one table for each salesperson and it shows the amount of sales for each combination that has sales.
The problem is this, I want the tables to show each combination even if it does not have any sales at all, it should just show 0 then in record count. Like Mike on the left has more combinations than john, I still want Johns table to show those combinations just with a 0 then, and it should be sorted the same on each table so they look the same, just different data in the cells.
Is this possible to do?
To solve this problem, you need to make a combination of data, from the database with itself. Your main analysis dimension, which will generate your combinations, is used/new and Exchange/Clean deal. So your combination should be:
The filter defined in the second database (right base) must contain a filter telling which person the table will be destined for. So, for each table, you must make a new combination that contains the person-specific filter.
I just took a sample from your original database (10 first lines) and the result is:

"Relationship may be needed" although relationship is set

I have two simple table in Excel 2010 - Products and Sales:
I then linked them into PowerPivot - and here created the relationship from Sales.ProductId to Products.Id - like this:
Now I'm trying to build a Pivot that for each productId in the Sales table also shows me the Category and the PurchasePrice from the ProductTable. However, here I'm stuck - because the relationship is somehow faulty. When configuring the Pivot, I get a message Relationship may be needed even if the relationship already exists. The resulting - wrong - pivot table looks like this:
though I'm actually trying to achieve this:
I know that I could create calculated columns in the Sales table of PowerPivot and pull all required data using the RELATED DAX function - but as the real world project requires a lot of joins and fields I'm hoping that there's a better solution than this workaround...
I uploaded the example file here.
Peter,
Your question was a bit more tricky than I first though and I spent quite some time digging around, but I think I found the solution after reading this article about making distinct count in related tables.
I have updated your source file (so that Sales table contains more than 1 sales per product) and uploaded it to my public Dropbox folder.
You can see that I created 4 new calculated measures to illustrate my solution and to make it a bit easier to understand (Excel 2010 terminology, in 2013 it's Calculated Field):
Sales Price Total
=SUM(Sales[SalesPrice])
Products Sold
=COUNT(Sales[ProductId])
Purchase Price per Item
=CALCULATE(SUM(Products[PurchasePrice]),Sales)
Purchase Price Total
=[Purchase Price per Item] * [Product Sold]
The key difference here is the formula for calculating purchase price per item. The reason why you should SUM the product purchase price within CALCULATE function is explained in great detail in the linked article (even though in a bit different context):
In this way, any filter active on Sales (the related table) propagates
to the lookup table.
There might be some other parts I missed, but I have tried this in couple other examples and it simply works as it should:

Query or filter on Fusion Tables?

this a question from a very inexperienced user.
I have a table with electoral results, with this format:
I have merged this table with city shapes and can do a map visualization according to one of the columns.
My problem comes when I want to do filters and queries. I am quite puzzled.
I know how to activate and deactivate layers from an html document, calling (showing and hiding) different fusion tables.
What I want to try now is using a sole fusion table for different ways to show the data. I don't know if this is possible.
For example, possible queries to show on different maps called from a html page:
show only rows with type (column H) 'rural' (filter?)
fill polygons with colours according to the greater value among column B, D and F (if value for party1_2012 is > than party 2 2012 and > than party 3 2012, polygon colour is blue; if party 2 wins, fill is red...)
fill polygons with colours according to the difference between 2 columns (i.e. 2010 and 2012 results)
map combining option 1 (when showing only rural city), apply option 3 (show a colour according the difference between 2 columns)
Inspired by John Keefe's post Making AP Election Data Easy with Fusion Tables, tried to play with data, but no luck. I'm too inexperienced. Is it the way to go generate csv and call them from a webpage? Can I just generate the maps on Fusion Tables and obtain a url to call the queried mapfrom a webpage?
I appreciate suggestions or ways to go.
Thanks in anticipation!
Frans

rails activerecord statistics/trends/time-series graph data

We are in the process of building dashboards for users where in they can see the trends/time series graphs of various activerecords; take a blogging site as an example. There are posts, each post has many comments and tags. There are 2 kinds of dashboards to be built.
a. trend graphs
b. time series graphs
trends graphs:
example, trending tags ( top 10, with # of posts), the ui looks like this
today [week] [month]
ruby-on-rails(20)
activerecord(10)
java(5)
When the user click on week, the trend shows the weekly data and so on.
And similarly, another trend graph is top 10 posts with highest # of comments
time series graphs:
for example, time vs # of posts, over a period of 24 hours, 1 week, 1 month etc.,
30
20 |
10 | | 10
| | | |
t1 t2 t3 t4
a visual example
Secondary Requirement:
The time series graphs cane be interactive and we may want show the actual data or additional series when a point is selected. Additional series: for example when the user selects point (t3,30) we want to show the tag name vs #count data.
ruby-on-rails(15)
activerecord(10)
java(5)
I have looked at statistics gem and it is good for generating counts but not graph data.
Question
Is there a gem(framework) to generate data for these graphs?. In our case, the graph data can be cached and refreshed every 15/30 minutes.
Is there any reason why you need a gem? A place that I've worked used Highcharts in combination with Ruby/Rails and that worked. You could also use the Google Chart API. I'm not sure how much you want to build out what you're doing, but you can create tables in a sql database that track whatever you want to be tracking, and then just feed those to the charting tool
Also, here are several services with API's that offer this kind of graphing capability.
StatsMix, Metricly, myDials, KPI Dashboard, and more

Resources