Talend - Count row on tOracleInput - sum

May I ask how to count the row of tOracleInput and place it to the tOracleOutput. At the same time, can I add the values of that column SUM(tOracleOutput.OS_BALANCE)?

You could use the tAggregateRow component like this:
You should leave group by paramaters empty and create an output schema that will hold the sum and count. The row generated will then be fed to tOracleOutput.

Related

SQL query - How to achieve the subsequent column updation by summing up the value of current row in Single select query (need to avoid while loop)

The logic which we are trying to achieve in single query is as follows.
We need to loop based on row number column. So, on each loop we need to sum-up remaining value and new value.. resultant value to be updated in "by summing up column". and the decimal part to be updated in decimal value column.
in next step, need to sum-up the decimal value column by grouping on row number. and the resultant to be updated in remaining value column of next row number
the above step 1-2 to be continued till we reach last record.
We achieved this through while loop.. But trying to achieve this without while loop.
Can someone please give idea to achieve this
Please refer the attached image for understanding table
enter image description here

SSRS - How to get column value by column name

I have one table with rows and each row has a column that contains a field name (say raw1 - 'Number001', raw2-'ShortChar003', etc). In order for me to get that value of these fields I have to use a second table; this table has 1 raw with many columns (number001, Number002, ShortChar003, etc).
How can I extract the value?
Good Question..You can use lookup function
=Lookup(Fields!CityColumn.Value, Fields!CityColumn.Value, Fields!CountColumn.Value, "Dataset1")
Or you might have to use string functions..ex LEFT, Substring, Right same like SQL.If possible pls post some data of both tables, I will explain in detail

Pentaho Adding summary rows

Any idea how to summarize data in a Pentaho transformation and then insert the summary row directly under the group being summarized.
I can use a Group By step and get a summarised result stream having one row per key field, but what I want is each sorted group written to the output and the summary row inserted underneath, thus preserving the input.
In the Group By, you can do 'Include all Rows', but this just appends the summary fields to the end of each existing row. It does not create new summary rows.
Thanks in advance
To get the summary rows to appear under the group by blocks you have to use some tricks, such as introducing a numeric "order" field, setting the value of the original data to 1 and the sub totals rows to 2.
Also in the group-by/ sub-totals stream, I am generating a sum field, say "subtotal". You have to make sure to also include this as a blank in your regular stream or else the metadata will be divergent and the final merge will not work.
Here is the best explanation I have found for this pattern:
https://www.packtpub.com/books/content/pentaho-data-integration-4-working-complex-data-flows
You will need to copy the rows too a different stream, and then merge or join them again, to make it a separate row.

Sum of distinct values in field SSRS 2005

I'm working on SSRS report builder that is using a dataset calling a SQL Server 2000 database.
The query is getting sums of a few different fields and is also pulling out all records that have to do with that client number. I want to get the sum of the sum but it is way over because of the detail rows. Basically what I want is the sum of the distinct sum column values.
=Sum(Fields!tot.Value, "table1_Group3")
I saw that you can get sums by the groups and I tried the expression above but it comes back with an error:
The Value expression for the textbox 'tot' has a scope parameter that is not
valid for an aggregate function...
table1_Group3 is the name of the group that holds the sum value in the report.
Any suggestions on how to get the distinct values to sum them in this report.
=Sum(Fields!tot.Value, "table1_Group3")
The code above will give you the sum of "tot" for all rows in the current "table1_Group3." This means that this expression only makes sense somewhere within table1_Group3. Otherwise, SSRS doesn't know which is the current instance of that group.
Sounds like you would like to sum this value across multiple groups, but only take one "tot" from each instance of the group. (Are you sure that all rows in that group will have the same "Tot?")
If tot is the total of other fields in your returned data, then simply add those up in your formula. This may have the added benefit of simplifying your SQL query as well.
Some other options that could work:
- Change your SQL query so that only one row per group gets the Tot field set.
- Use Embedded code in the report to keep a running total which is added to only once per group, such as in the group header.
(If upgrading to 2008R2 SSRS is an option, then the Lookup function could be used here, maybe even to look back at the same dataset.)
change the query/ dataset to sum(distinct tot) using the temp table on the sql server
I suppose you need to write sum(distinct columnName).

SSIS 2008 Row Count Transformation - Row count return 0

This should be rather simple but I don't know why I get Row Count as Zero when I use ROW COUNT transformation in Data Flow Task. I have created a variable(NoOfRecords) with Package scope.
Variable name set to variable NoOfRecords in Row Count Transformation.
Used a Derived column to assign the row count.
The package runs successfully and shows record count 265
But the Derived column shows record count as 0 instead of 265 rows.
After the Row Count, add an Aggregate Taks and select count option in the Operation tab in the Aggregate task properties.
Then you can use the row count variable for further operation where it holds the total row count of the input file.
Row Count is processed after rows has passed.
You're adding the variable to each row as they pass through the Derived Column step, but at this time, the variable has not been updated (as it happens after all rows has passed) - so the value 0 is correct.
You -might- be able to achieve this by using an asynchronous task before your derived (but i'm not sure this'll work, it just popped to my mind). Add a Sort or Aggregate step before your Derived and try again.
I used this in the query as an efficient way of getting the row count:
count(all SnapshotDate) over () as nRowCount
Here's the successful technique for recording rows that worked in my situation.
The scenario is I want to log the rows migrated between tables. The RowCount doesn't get populated until you exit the DataFlow.
[Control Flow]
1. Data Flow Task
a. read origin data - Source control
b. Add RowCount transformation. Link a to b.
Right-click RowCount and map to UserVariable (int64)
c. Add Destination control for loading table.
d. Link b to c.
2. Add Execute SQL Task to ControlFlow. right click, edit
INSERT SQL statement: Insert Into LogTable(rowcount) Values(?)
Parameter Mapping
Variable Direction DataType ParameterName ParameterSize
User::RowCount INPUT LONG 0 -1