Cheat Sheet of Formatter Methods

All these dot function thingies that Wappler creates… like .where(), .add(), .contains(), etc (are they called “methods” in programming?)… I have some questions about these:

  1. What language are they?
    Are they technically javascript but methods created as part of dmxzone? What other language constructs can I put there? Because all the x==0?:y=0:y=1 syntax is javascript, right? :confused:

  2. Where can I find just a nice little list/cheat sheet of all these method thingies I can use?

Thanks in anticipation,
Antony.

2 Likes

Hi Anthony,

Those are called data formatters and are part of the App Connect formatting library.

When you use the data formatter dialog each formatter shows a small help text what it does and it’s parameters.

The whole expression follows the JavaScript standarts and the formatters behave like methods indeed.

Do note that each formatter operates on the specific data type it supports. So we have different ones for numbers, text, arrays and Booleans.

All that is build in the data formatter dialog that is behind the magic wand icon on the data picker dialog.

1 Like

Hi George...

Thanks for the details!

Is there any documentation listing them all?

The reason I ask is sometimes I note in the videos and find myself that the Wappler GUI isn't able to create the structure of these methods that I need, or I am finding it very hard to work out the menu clicks to do it, whereas just typing the sequence of methods into the code I can get what I need very quickly.

Some recent examples from my work are:

Combining multiple .where()

dmx-bind:options="lookups.data.lookups.where(lookup_type, 11, "==").where(is_a_demo, show_demo_data.value, "==").where(is_hidden, 0, "==").where(is_deleted, 0, "==")"

Following a .where() with a .values()

dmx-text="lookups.data.lookups.where(id, region, "==").values(lookup_name)"

To do these I have needed to type in the code, and, for example, with the .values(), I couldn't remember the syntax for it so I had to go off and create another example using the GUI and then copy the format of the .values() method.

A Cheat Sheet would be so much more useful!

Also, I find it hard from the small amount of description to know exactly what the method does... so a cheat sheet with a small example for each method would be such a time saver!

Best wishes,
Antony.

Yes there are docs when you search on data formatting:

If your data is well defined in a scheme or coming from a database, you shouldn’t have any troubles with the Wappler UI providing you the right pickers.

When you do it by hand - many errors can occur as I said those formatters are type strict. And it will cost you lots of type to discover.

Thanks for your feedback George!

Those docs are useful but aren’t really the cheat-sheet kind of documents I was looking for…

… and I hear what you are saying about using the menus rather than editing the code, and in some circumstances that is true… but definitely not in others, such as:

  • The two examples I gave in my initial post. There is no obvious way to create those from the menu system at the moment but they are important things to be able to achieve.

  • If you have a complex repetitive structure throughout your design it is many times faster to copy and less error prone to search/replace edit a large snippet of code than to keep repeating 30 menu clicks that you need to remember to get right each time. I can give you an example from my design if you would like to see that!

The beauty of Wappler for many users I feel is the ability to mix code and menu based input.

Best wishes,
Antony.