Hi,
lets suppose we have an excel, and specific field is a string like “A,B,C,D”.
I can convert it into an array using custom script, but as far as I know the result could only be used as a single result and not as a collection.
It will be great to use that result as a source to a asset grid for example. Is that possible?
In order to use your result as data feed to a Collection in Intuiface, you will have to convert your: "A, B, C, D" (which is the value of a single cell) into 4 rows, containing respectively "A", "B", "C" and "D".
I was asking about a way inside Intuiface after getting data from Excel.
Example of data structure in a excel sheet
NAME | COLORS
Shoe | “black, grey, white”
It will be great, if it was possible to split colors field by “,” in intuiface and return a result in a form that could be passed to an asset grid (like arrays on API REST)
Will be a way to have a “1 to many” relation in excel, in this case 1 product has N colors
I agree, that would be a nice idea, and I suggest you post it in our #wishlist category
In the meantime, because an Excel sheet is a 2D table by nature, you’d have to split these colors on multiple rows.
In these cases, we usually create a separate sheet that would assign N colors to 1 product.
@seb yes you are right and my first approach, more clear way to structure data was like you said. But my problem always raise when I need to show multiple items with respective colors at same time.
Only option, using Excel, that I found was to have all in same sheet and by limiting number of colors and create N columns per color. Not a perfect solution, first is not an elegant way to structure data second it is limiting number of “colors” that an item could have.
1 column per color is indeed the right solution to your use case, if you need these multiple colors displayed for multiple items, just using Excel.
The “ideal” solution, for a clean “data base”, would be to have a Custom Interface Asset that would parse the data base and the list of colors and would create the proper data feed with nested lists. Something like:
Such a structure would enable you to have a collection representing the colors, nested in the collection of products. Excel can’t generate such a structure, but APIs & custom Interface assets (.NET or JS) can.
I don’t think I ever wrote one in JS. You can take an example in the Shopping List for simple lists, then use the IFD from .NET IA used the Dynamic Collection sample I shared with you.