Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Quick hacks: Displaying fields

merituulimelkko75
Product and Topic Expert
Product and Topic Expert
0 Likes
817

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 valueExample 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!

1 REPLY 1
Read only

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Likes
756

😺

P.S.: Never thought of you as lazy, but good to know




--------------
See all my blogs and connect with me on Twitter / LinkedIn