Creating an easy index in collection

I think I need to use a hook here. as my collection grows, I add fields to accommodate needs.
The Problem I have here is when I want to modify data I really need a unique ID beside using ID. What I would like to do is to concatenate a few characters from a few fields to create a unique ID. I am looking for help on using the right language and function. here is a sample of a record.
[{“_id”:“d47393d3-1713-4443-98cc-d9de1f80d422”,“year”:“2015”,“originalCatalog”:“Wisanka Contemporary Teak”,“style”:“Contemporary”,“feature”:“Stainless”,“title”:“Dining”,“vendor”:“Wisanka”,“page”:“61”,“hight”:“85 “,“width”:“45”,“lengthDepth”:“50”,“leveckCode”:””,“itemFamily”:“DILI DINING CHAIR”,“indoorOutdoor”:“Indoor”,“itemDescription”:“Dili dining chair”,“detailedItemDescription”:“Solid teak wood construction . Slatted back and padded seating area . Arm chair available upon request and fabric material or leather material available for seating areas. “,“leveckProdDescription”:””,“_createdDate”:“2017-12-01T22:04:45.385Z”,“_updatedDate”:“2017-12-01T22:04:45.385Z”,“link-INDOOR-FURNITURE-indoorOutdoor”:“/INDOOR-FURNITURE/d47393d3-1713-4443-98cc-d9de1f80d422”},

I also need to know if I can add a function to search for a record on my modify page I created. all I can see to do is previous and next.

2 Likes

Did you ever figure this out? I am looking for similar assistance.

Hi, see here about how to use hooks.
I think this has all you need.

Liran.

Hooks are awesome! Question… is the afterUpdate hook triggered whenever the content of a field in the collection changes? Or only when you call the Wix-Data update() function?


:slight_smile:

But the only two ways to change data in the collection are update() and insert().
So you can also use afterInsert().

Liran.