Last modified data

Hi, I have an app for supply chain that I use to calculate the delivery dates and inform my customers if it changes.
I have a table with packings: APP_PACKINGS
I have a table with delays: APP_PACKINGS_DELAY

As I can have multiple delays for one packing, I must check the last modified delay (all the rows have a message in case people want to check why there is the problem). I tried 2 ways to do it:

1st Option:

LOOKUP(MAX(SELECT(app_packings_delay[date_add],
		[_THISROW].[as_id_packing] = [as_id_packing])),
	app_packings_delay,
  date_add,
  delay
)

2nd Option:

LOOKUP(MAXROW("app_packings_delay","date_add",
		([_THISROW].[as_id_packing] = [as_id_packing])),
	app_packings_delay,
  as_id_packing_delay,
  delay
)
  1. What would be the best one in term of efficiency? I do not want my app to be delayed too much.
  2. Is there a 3rd solution much simpler that would not involve 2 lookups in the same tale? (one to find the row then one to find the value)

Thanks a lot

0 10 930
10 REPLIES 10

Steve
Platinum 4
Platinum 4

For both of the options you presented, what happens if more than one app_packings_delay have the same date_add value?

@Steve it is a timestamp (datetime) so I hope it will not happen

I think option 2 is your best route.

In terms of efficiency, maxrow() is pretty efficient (especially over a select()) and lookup() is fast as well.

Where were you going to use this? A virtual column, in a workflow, a column value?

I use it in a virtual column

Just FYI, formulaโ€™s like this:

while being efficient, they can cause a slowdown during the sync process if you have a lot of data - the reason being is that for every row in the table with this formula, itโ€™s running through that calculation.

Just something to keep in mind as your app collects more data, things like this start to become more and more costly. If you notice things getting slower you might consider moving that virtual column to an actual column, this way the data is stored instead of calculated on the fly.

Indeed. in this case I would just use workflows to go and update the column when I had a delay. It would even be faster with a trigger in the database but there is no action to force the synchronozation of the app when it is done.

Itโ€™s only recently really becoming widely used, but theyโ€™re actually is a way to force a sync.

But keep in mind: itโ€™s still a sync, it takes time. Be judicious.

You are right indeed. It might not be the best solution yet.

Good to konw indeed. Thanks a lot !

Top Labels in this Space