getPastEvents recursive loop - ethereum

Consider there are 30000 events in a contract.
getPastEvents() method returns max 10000 results and if something goes above 10000 it throws error. Is there any recursive option where we can loop and track the 10000 results. When it comes to 10000 it restarts from that last block number and fetch another 10000.
First loop 10k, second loop 10K, and third loop 10k without any error summing up 30k.

Related

Jmeter - extract different rows from csv for every thread for every iteration

Is there a way to extract from a CSV file two rows (need to give to a sample two rows parameters) and to give a thread and repetitions different rows? I mean first thread first repetition must take first and second row, second thread first iteration must take third and fourth row and so on. But then first user second iteration must take fifth and sixth row and second user second iteration must take 7th and 8th row and so on.
Go for __CSVRead() function
${__CSVRead(test.csv,0)} - read first "column" from the test.csv file
${__CSVRead(test.csv,1)} - read second "column" from the test.csv file
${__CSVRead(test.csv,next)} - proceed to the next row
So if you do something like:
${__CSVRead(test.csv,0)} ${__CSVRead(test.csv,next)} ${__CSVRead(test.csv,0)} ${__CSVRead(test.csv,next)}
you will get the required behaviour.
Demo
used components:
__threadNum() function - get the number of the current thread (virtual user)
${__jm__Thread Group__idx} - get the current iteration for the Thread Group
View Results Tree listener - visualize the values of functions and variables
More information: How to Pick Different CSV Files at JMeter Runtime

Trying to pull Max date less than Date on the row

I know this is a tough one but I'm basically trying to say. Give me a service call and its completion date, then give me the Max date for all service calls where the date is less than the date of the service call I'm inquiring about.
Basically the end result I'm looking for is to say was there another service call on this piece of equipment that was within the last 30 days.
So as you can see in the image for say Asset 50698 service call 579032 we have a date of 11/9/2020 the call below that was 10/22/2020 which was less than 30 days. I want to somehow find a way to count how many service calls I have where this has occurred. Is this possible?
I think you're looking for a context operator In, ForEach or ForAll (in in this case)
Add a variable "MaxAssetDate" and assign it a Formula similar to the following based on your column headers.
=Max([Service Call Completion Date] In ([Asset ID];[Service Call])) In (Asset ID])
Then add this as a column. Provided you have a prompt filtering for a given asset or "date" this column will then show the max date for each service call of the same asset ID. Then add a new variable: ServiceCallDaysDiff: Then by using DatesBetween() with "MaxAssetDate" and ServiceCallCompletionDate and DayPeriod; =DatesBetween([ServiceCallCompletionDate];[MaxAssetDate];DayPeriod) you should get a number 0-X. Then add a filter based if the number is between 1 and 30 then you show those records, otherwise hide the rest; or do whatever logic is then needed.
Now if you're dealing with hundreds of thousands of records this isn't ideal as you're putting all the processing on the webi engine when it ideally would occur as an object in the database layer. However if you only have a few thousand records this should be managable.
To add a count of service calls...
add variable: ServiceCallsCount:
=Sum(Sum(If([ServiceCallDaysDiff]=0;0;1)) In ([AssetID]))
this will count the non zero day differents. Note this will extend beyond 30 so if you want to limit by 30 days adjust the if statement to zero out those not between 1 and 30.
This is but one approach: there may be simpler ways.

mysql merging lines function

I have a table in mysql where thousands of phone calls are saved. Some telephone operators send telephone calls in multiple records. Phone calls are shuffled and must first be sorted by caller, called and date.
Here is an example
Id|Caller|Called|Date|Length|CallerImei|CallerImsi|CalledImei|CalledImsi|CallerCGIStart|CallerCGIEnd|CalledCGIStart|CalledCGIEND
"9"|"+39123"|"+39321"|"2018-08-03 03:10:18"|"351"|"8629"|"222"|""|""|"0117"|""|""|""
"16"|"+39222"|"+39111"|"2018-08-03 03:17:04"|"106"|"8629"|"222"|""|""|"4590"|""|""|""
"18"|"+39222"|"+39111"|"2018-08-03 03:17:04"|"106"|"" |""|"8629"|"222"|""|""|"4590"|""
"3"|"+39333"|"+39355"|"2018-08-03 03:06:23"|"146"|"8630"|"222"|""|""|"0117"|""|""|""
In the row with ids 16 and 18, the call is divided into two records. In line 16 there is some information, in row 18 there are others. We can recognize the call because it has the same date, same duration and the same caller and called. Also some phone calls may have more than two lines or the duration may be slightly lower, but if the previous phone call lasted longer than the one that follows it ... it is definitely the same phone call.
I would like to do a merge this way.
Id |Caller|Called|Date|Length|CallerImei|CallerImsi|CalledImei|CalledImsi|CallerCGIStart|CallerCGIEnd|CalledCGIStart|CalledCGIEND|ListIDMerged
"1"|"+39123"|"+39321"|"2018-08-03 03:10:18"|"351"|"8629"|"222"|""|""|"0117"|""|""|""|"9"
"2"|"+39222"|"+39111"|"2018-08-03 03:17:04"|"106"|"8629"|"222"|"8629"|"222"|"4590"|""|"4590"|""|"16,18"
"3"|"+39333"|"+39355"|"2018-08-03 03:06:23"|"146"|"8630"|"222"|""|""|"0117"|""|""|""|"3"
Then create a table with the result of the merge and a column that takes into account the merged rows for a possible control
Thanks for all

setFirstResult() and Limit Failing in Ejb3.1

I have 10000 records in database i want to fetch 100 record first time next 100 record 2nd time and so on. I'm using setFirstResult() and maxResult(). I'm maintaining a counter to update set first result offset setFirstResult(count) is always started from first index whatever value you put inside it, it start from 0.
List<StudentBo> bos=manager.createNamedQuery("getAllApplicantForRegistration")
.setParameter("batch",dto.getBatch())
.setFirstResult(count)
.setMaxResult(lastIndex).getResultList();
setFirstResult will incease every time while setMaxResult will be static.

Cumulative Row Count In For Each

I have a row count inside a foreach. I want the variable to have the total number of records that passed through in all iterations of the for each - cumulative sum. However, it seems that only the last iteration holds.
Is there a way to do this?
Thanks
A Row Count component appears in a Data Flow task, not a Foreach task. So, I assume you have a Data Flow task in the Foreach task.
The Row Count component only captures the count for the current run of the Data Flow task. There isn't an inherent way to capture the cumulative total; so, you will have to do it yourself. One way is to create another variable to store the cumulative total and a Script task that adds the Row Count variable to the cumulative count variable. The new Script task would appear in the Foreach task and follow the Data Flow task.
Create two variables:
store row count for current look eg : rowcount
store total row count eh eg : totalRowCount
Use Expression Task after data flow task
totalRowCount = totalRowCount + rowcount