‎2024 Oct 07 9:19 AM
Like most developers, I'm very lazy and want to do things the neat, quick and cool way whenever I can. Today's quick hack is showing you how I very quickly display the fields of a data resource, whether it be on a list or on a detail page.
This hack is specifically for those text or number type fields that you don't want to style in any specific way, but want to just show with a label and the content below.
Example of fields with label and value
Whenever I need to do this, I take the Object I want to display and do a nifty formula using MAP, KEYS and LOOKUP. The following example is done in a situation like above when the Object I want to display is repeated.
MAP(KEYS(repeated.current), {key: item, value: LOOKUP(repeated.current, item)})
If you don't want all of the fields displayed (or want to display some fields in a different way), you can omit those fields using OMIT_KEYS formula, e.g.
MAP(KEYS(OMIT_KEYS(repeated.current, ["id", "image"])), {key: item, value: LOOKUP(repeated.current, item)})In addition, you could of course for example style the field names (e.g. capitalizing with CAPITALIZE).
Hope this helps or gives you ideas for how to use formulas in your apps!
‎2024 Oct 08 3:28 PM