Solved

How to set a condition that a list view is empty for validation putposes

  • 25 February 2019
  • 3 replies
  • 208 views

Badge +5

We have a list view that items get added to by a feature on another, populated list view. Any number of item can be added to the first list view. I need to validate whether the first list view is empty. The list view has items like name, category and administrator. I tried setting a rule  on the list view that the Name Data Label did not containe a value then show a message that nothing was selected. This works half way correctly. If nothing is selected the message shows.  But then I seleccted and item and the name data lable definitly was populated but the message still popped up. How can you structure the condition that if just on item is populated in the first list view don't show the message.

icon

Best answer by JacquesP 26 February 2019, 08:43

View original

3 replies

Good day jaswerl

 

The logical procedure of rules I will explain below :

.

1) You will first perform a getList method on the smart object that populates the listView.
2) On the output mappings, you will populate a hidden textbox with any value. This entails that is the getList will populate a textbox if any value in the smart object is found.
3) Test if the textbox contains a value
4) If it does Perform a getList to populate the SmartObject to populate the listview. After this clear the value of the textbox which will reset it for the next event and not keep it populated resulting in not showing the message on an empty list.
5) If the text Textbox is empty(else) Show a message that there are no items to display.

 

The screenshot start event is on the button but this makes no difference in contrast with your start event.

See the attached screenshot for the rules.

 

If this post solves your problem at hand please remember to mark it as a solution or Kudo it.

 

Thank you.

Kind regards
Jacques


Badge +5

Thank you JacquesP. I think I will try the first 2/3 of your solution. But I think I want to create a counter, to count the nmber of items added to the second list from the first list and query that. If there is a number submit the form. If the number is zero or null show the message. Only I don't know where to put the counter--in a smart object and a list view (couldn't figure out how to add a lone text box to the list view), or just put a hidden text box on the form. Do you have any advice?

Badge +5
Since the process that adds the items to the second editable list I just set a counter on the first field in the list and queried that.

Reply