I want to split one order (with several items) into a number of copies equal to its items number. Then each item will be processed alone. After that, all should be rejoined/combined together as one agent.
order arrive (with items information stored in two variables: required processing time for each individual item in the order and total number of items)
order checked as a whole (process/delay)
order split to several copies equal to its number of items ( I used the variable: total number of items in the Number of Copies field)
Items are processed one by one, and each item is processed/delayed to a time equal to the variable: required processing time of this item
Finally, all processed items are rejoined/combined in one box/agent that represents the ready order.
Is this possible using combine, match, and other relevant blocks? How, please?
Related
Is there a way for me to know if the stream of rows has ended? That is, if the job is on the last row?
What im trying to do is for every 10 rows do something, my problem are the last rows, for example in 115 rows, the last 5 wont happen but i need them to.
There is no built-in functionality in Talend which tells you if you're on the last row. You can work around this using one of the following:
Get the row count beforehand. For instance, if you have a file, you
can use tFileRowCount to count the number of rows, then when you
process your file, you use a variable for your current row
number, and so you can tell if you've reached the last row. If your
data come from a database, you could either issue a query that
returns the total number of rows beforehand, or modify your main
query to return the total number of rows in an additional column and
use that (using ranking functions).
Do some processing after the subjob has ended: There may be situations
where you need a special processing for the last row, you can achieve
this by getting the last row processed by the previous subjob (which
you have already saved, for instance, by putting a tSetGlobalVar
after your target, when your subjob is done, your variable contains the last written value).
Edit
For your use case, what you could do is first store the result of the API call in memory using tHashOutput, then read it with a tHashInput in order to process it, and you'll know then how many rows you have retrieved using tHashOutput's global variable tHashOuput_X_NB_LINE.
I have a large table of inter-related entries (too large to simply query them all and group them). I would like to page through them, but I want to make sure all my groups contain all the related entries, with the total number of rows used to generate those groups limited. The groups are different sizes, so simply limiting the number of groups returned does not guarantee a set that is small enough to process.
In pseudo-code, give me all the complete groups (using GROUP BY) that can be generated using no more than N rows. Then I need to process the next "page" (using OFFSET?). My current query to process all the rows at once (takes WAY too long on a large table) looks like this:
select addressresult->'matchElements' as match,
addressresult->'foundElements'->'element0'->>'type' as type,
array_agg(id) as ids,
count(id) as items
from address
group by match, type
having count(id) >= 5;
I'm building an advanced report to pull data from wordpress/woocommerce. Most data is in a meta_value column with a meta_key to link with.
I want to pull the meta_value where meta_key is equal to a few key values, such as _price or _stock. I can write the below formula to pull one specific item from that table, but I need about 10 different items and the ability to group by the values. We're not able to add additional groups by running totals.
if {wpyj_postmeta1.meta_key} = "_stock" then {wpyj_postmeta1.meta_value}
How can this be done without subreports?
I would like to know how to tell the number of columns in a table created in iReport. The variable COLUMN_COUNT returns the number of rows, but I want to know the number of columns.
Does anyone know how to do?
The quotes from JasperReports Ultimate Guide:
BUILT-IN REPORT VARIABLES
COLUMN_NUMBER
This variable contains the current column number. For example, on a report with three
columns, the possible values are 1, 2, and 3. The variable restarts from 1 and runs up to
the defined number of columns for each page in the generated document.
COLUMN_COUNT
This variable contains the number of records that were processed when generating the
current column.
PAGE_NUMBER
This variable’s value is its current page number. At the end of the report-filling process,
it will contain the total number of pages in the document. It can be used to display both
the current page number and the total number of pages using a special feature of
JasperReports text field elements, the evaluationTime attribute. You can see this
happening in most of the samples. Check the /demo/samples/jasper sample for an
example.
REPORT_COUNT
After finishing the iteration through the data source, this report variable contains the total
number of records processed.
PAGE_COUNT
This variable contains the number of records that were processed when generating the
current page.
GroupName_COUNT
When declaring a report group, the engine automatically creates a count variable that
calculates the number of records that make up the current group (that is, the number of
records processed between group ruptures).
The name of this variable is derived from the name of the group it corresponds to,
suffixed with the _COUNT sequence. It can be used like any other report variable, in any
report expression, even in the current group expression, as shown in the BreakGroup
group of the /demo/samples/jasper sample).
I have a report that I've written and I understand how to create running totals and such, but need help creating a custom evaluation formula.
I have two levels of groups, first group is based upon a certain user, the next group is based upon transactions that user has been involved in. I have details hidden, and am only interested in the totals for a particular activity. This is working great, and totals are working properly but the problem is, each activity has a 'line number', which essentially can be the same as another activity (ie: two activities can have lines 1, 2, 3 contained within), so doing a distinctive total based upon a set of data isn't accurate because I only want it to be distinct based upon each individual recordset, and not globally.
The example is below... if I do a count on each record for this dataset, it comes out to 18 because there are duplicate line numbers on each... but if I do distinct, it only comes to 9 because of duplicate line numbers across multiple actives.
I guess what I need to know is how I can take the totals per detail group, and have them total up in my second footer properly. I assume it's going to take me compiling together a string including the activity number and line number, and then comparing them?
Here is an example of the data contained within the total groupings:
I figured this out on my own... turned out it was pretty simple. I converted my numeric values to text, and included a copy of the transaction id and the line id as my test value, and did distinct on that... Sometimes it just helps not staring the problem down.