words counter

0
 I'm using Mendix 10.24.6 and need to create a real-time counter (e.g., 0/6) below a Text Area that increases when users type words separated by spaces, with a maximum of 6 words. Context Currently using Mendix version 10.24.6. Error/Issue None provided. Relevant Information Sample example or code snippets related to the Mendix version or similar context would be helpful if available.
asked
1 answers
0

Hi Waad,

1. Create an attribute in the entity e.g. WordCounter (Integer).

2. On change event, call a microflow (just because we need to use StringSplit java action from CommunityCommons)

3. In the microflow:

    - First check $entity/attribute is not empty, e.g. $entity/attribute != empty and trim($entity/attribute) != ''

    - Then, create a string variable named 'VarInput' with replaceAll(trim($entity/attribute), ' ', '~')

    - In the next activity, call the StringSplit java action, pass input string VarInput and SplitParameter as '~'

    - Once you get the list of items, then you can use Aggregate list activity to get the count

    - Change the entity where WordCounter attribute exists. Do not commit the entity

- Use the attribute WordCounter to show on the UI

 

 

Thanks

 

answered