Hello,
I’m doing an Asset Management doc. I have a table to track each asset when it has been checkin to a person/location/other and when it has been checkout.
I embed an example:
I wanted to add some check to know the status of an asset and, just for me, to know if I inserted some wrong date.
I would like to share an example of what I’m doing also to get some suggestions about my approach.
A little explanation of tables:
- Single assets: just a list of the assets.
- Asset tracking: the table to track each asset.
Asset
: is the primary field and is a relation toSingle assets
table.Checkin
is to track when the asset has been assigned to someone/somewhere.Checkout
is to track when the asset has been returned.Checkout Count
is the number of times an asset is returned.Asset Count
is the number of times an asset is in the table.Status
it’s where I’m stuggling.
This is the formula in Status
.
SwitchIf(
thisRow.[Checkout Count]=thisRow.[Asset Count], "Free",
And(
thisTable.Filter(thisRow.Asset=Asset).Checkout.Sort(False).First()
>
thisTable.Filter(thisRow.Asset=Asset).Checkin.Sort(False).First(),
thisRow.[Checkout Count]<thisRow.[Asset Count]
), "Check tracking",
thisRow.[Checkout Count]<thisRow.[Asset Count], "Assigned"
)
Explanation:
- If
Checkout Count
andAsset Count
are equals it means the the asset is returned so it’s free to be deployed again. - If the most recent Checkout date is greater than the most recent Checkin date and
Checkout Count
is less than theAsset Count
it means that I have done some mistake in Checkin/Checkout fields of the asset (See in the example PC03) and the Status is “Check tracking” to alert me. - If
Checkout Count
is less thenAsset Count
it means that the asset is not returned so it’s Assigned.
Now the question: I would like to add another check, I would like to check that the checkin/checkout dates of an asset are correct, so a checkout date can not be later of the next checkin date, this is not possible.
So in a scenario like this:
I should get an error cause the asset cannot be checkin (01/09/2024) before it has been checkedout (05/09/2024).
How could I achieve that and what could be other checks and suggestions?
I’m new to Coda and I maybe I could reach same result in a simpler way.