Query problem

Hello,
I’m trying to bring the fuel price from the “Preturi combustibil” to the “Registru Productie” according to the last entered date and the car’s registration number. My problem is that the car is not refueled at the gas station every day and when the date is between the 2 refueling (for example the date of 28.01.2024 is between the dates 26.01.2024 and 29.01.2024) it should be filled with the fuel price of the date of 26.01.2024, not with fuel price of the date 29.01.2024.
In these print screens I tried to do it myself, but it doesn’t work. Does anyone have another idea?


Does it mean you need to pull the info from the last line the signed-in user has entered to the “Preturi combustibil” table?

Isn’t this basically the same problem that we already solved below?

Well, not really. This time I want that the price to remain unchanged because I want to calculate the total value of the fuel for each day and each car.
I also used your advice and I thank you for that, but for example I want that the price to be for every day, only on the days when a fuel receipt is not entered to bring me the last price. I think I need to enter something new, but I don’t understand what. I must specify that I do not want this to be set by the user, but automatically when they enter the registration.
1/25/2024- price 7.80
1/26/2024-price 7.40
1/29/2024-price 7.40


So ultimately, what is the link between your “Preturi combustibil” table and the “Registru Productie” table? Is it a combination of date and license plate? I’m just trying to understand your data’s logic here and what you’re trying to get.

Yes, it is a combination of date and license plate. I try to bring into the “Registru productie” the price of fuel based on date and license plate, but with conditions I mentioned above.

I think a query with with conditions to match, License Plate is This Row → License Plate l, and Date is on or before This Row → Date, should work. Set the query sorting to sort ascending by date and only return 1 row. Then use a Single Value column to retrieve the fuel price from the query.

1 Like

Yes, it worked. Thank you very much!!! :clap: :clap: :clap:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.