Solutions
Who uses Directual and why?
What can be built on the platform?
🇬🇧
Let's say you have an array link that you created using the Find object step, and now you need to sort this array and make a list that contains the following information in a specific order:
The Find object step allows you to search for objects in different data structures. It also can:
Let's use a data structure called Users as an example. It has only three fields:
Now let’s create a new data structure and name it My_struct. This data structure also has three fields:
Now you need a scenario to do all the heavy lifting for you.
Create a new Scenario. Next, in the Edit object step, select the Users_to_display structure. Enable Coding Mode and type the following expression:
Please note that we don't need double quotes around {{age}}, because the value is number. Following the JS-notation we don't quote numbers and booleans.
This expression allows you to apply the sortByAll method to the array, then collect an array of strings, and, finally, with the help of the join function, to convert a JS array into a Directual array.
Please note! Directual is only compatible with Lodash version 3.10.1.
Important! Don't forget that arrays and array links in a Directual database are strings, where the elements must be separated by a comma. To convert a JS array to a Directual array, use the .join(",") function, and the split(",") function to convert it back.
Okay, now run the object through the scenario. Glorious, isn't it?
You can also use templating for the array to make it look even nicer:
You can use the sortByOrder method to change the order in which items are sorted:
Use `desc` - for sorting in descending order and `asc` - for sorting in ascending order.
The expression shall look like this:
There's a lot of cool stuff you can do with Directual and Lodash. Go ahead, experiment! If you get stuck, don't hesitate to ask for help in our No-code Community. Also, check out our 101 crash course to learn more about Directual and its features.
Lodash is a JavaScript library that provides utility functions for common programming tasks using the functional programming paradigm.
An array is a collection of items, or data, stored in contiguous memory locations, also known as database systems.
Yes, you can. But keep in mind that Directual supports version 3.10.1 of Lodash.
Hop into our cozy community and get help with your projects, meet potential co-founders, chat with platform developers, and so much more.