Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to get the actual value from the cummulative value in talend ? for example On a paricular a car runs for 1000 kms next day the car will start from 1001 kms ,So what i need is how to calculate the total kms covered on a particular day
1000kms on 27-10-2017 2000kms on 28-10-2017
so the total kms covered on 28-10-2017 is 1000kms how to do that in talend for which i need to update around 1 lakh history records using the above method and this needs to be done in mongodb
Assuming your data looks similar to this.....
Day Total Miles
1 100
2 150
3 175
4 230
5 301
.....and you want to get the values.....
1 = 100
2= 50
3 = 25
4 = 55
5 = 71
....you can do it with a tMap. I have done this to demonstrate. The screenshot of the tMap is below....
The tMap variables (the box in the middle) must be set up exactly as above. The expressions are....
todaysDistance
Var.lastDistance!=null ? row1.miles - Var.lastDistance : row1.miles
lastDistance
row1.miles
The trick here is that the tMap variables keep their values between rows and are processed in order.
Your dates must come in in order for this.
Assuming your data looks similar to this.....
Day Total Miles
1 100
2 150
3 175
4 230
5 301
.....and you want to get the values.....
1 = 100
2= 50
3 = 25
4 = 55
5 = 71
....you can do it with a tMap. I have done this to demonstrate. The screenshot of the tMap is below....
The tMap variables (the box in the middle) must be set up exactly as above. The expressions are....
todaysDistance
Var.lastDistance!=null ? row1.miles - Var.lastDistance : row1.miles
lastDistance
row1.miles
The trick here is that the tMap variables keep their values between rows and are processed in order.
Your dates must come in in order for this.
I need to calculate based on the customer id how to include that condition in tmap
You do not need to use tMemorizeRow. This configuration will work without that.
To do this via CustomerId, you will need to sort your data by CustomerID and date first (tSortRow), then have some logic to decide when your CustomerId switches. You can do this using the tMap variables as well. However this is a different question and I have thrown away my example.
Accept this as the solution (if it shows the distance between days, forgetting the CustomerID) and raise the CustomerID changing as a different question. There should only be one question per post.
The operator != is undefined for the argument type(s) int, null
There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio. Is the error i am getting
If you are using Talend 6 you should be using java 8.
int is a primitive type. This means that your tick boxes next to your variable config are not ticked. The "Nullable" tick box means they become Integer objects instead of int types.
Not if you are following the example I gave you. Can you take a screenshot of what you have?