Table not shown fully


#1

I have a page with a table:

The query’s that I use to filter the database query / table are:

  • Part status
  • Status
  • Search

I set the parts and status query’s like so:

These are the database conditions:

The problem is that the table is empty unless the user has clicked 1 status, and 1 part status. As shown in the screenshare: https://www.useloom.com/share/b56a66b567994c27b933483e1f4a1a4d

How can I make it that the table is shown fully, so with ALL status or part status selected? Because if I remove the database condition entirely, the table is shown fully. Just not when I want to filter on the status or part status.


#2

If the user doesn’t select anything from the status dropdown lists, you want the second group of conditions in your query to be ignored, so you need to add a condition to this group, eg:

You could copy one of the GET variables or create an expression with both if necessary (eg if the user can select one without the other).


#3

Thanks for your help. In this case the user should be able to select one without the other. What would a correct expression be?

I’m not quite sure what the field you pointed out does exactly. Is it something like: ignore the second group of conditions when x,y,z?

If you could give me some pointers that would be great.


#4

Hi Nevil,
the input above the filter/filters group is a condition field. What it does is:

  1. You enter a dynamic expression as a condition
  2. If the condition is TRUE then the filter(s) will be applied, otherwise - they won’t be applied.

In your case, if you want to activate the filters when a users selects any of the two fields, then your expression will look like:

{{$_GET.part_status || $_GET.status}} - this means if part_status OR status return value, apply the filter(s).

Using a GET/POST variable as acondition like {{$_GET.variable}} checks if the variable returns a value and if it returns a value, the condition is TRUE, otherwise it’s FALSE.


#5

Thanks, I understand how it works now.

I have entered {{$_GET.part_status || $_GET.status}} in that input field but the table still doesn’t show any data on default. Only if I have clicked both status and part status.

See screenshare: https://www.useloom.com/share/fb200521af7a4acb8b6c0eb1755688ab


#6

Are you sure this should be AND here?

Also i see in your video the expression is wrong, it’s not:

{{$_GET.part_status || $_GET.status}}
but
{{$_GET.part_status}} || {{$_GET.status}}

make sure to paste exactly how i provided it.


#7

Ah I see, I would have thought that the {{ }} should always be around the variable. This is the only exception then I think?

It does load the table on default now!

The problem now is, I have set the group to OR, but then when I have set both a status and a part status, it doesn’t show the correct data. It does when I have set the group to AND, but then the table is empty when I have only set either status or part status…


#8

The expressions should always be inside the {{ }}:
{{var1 > var2}} or {{var1 == var2}} etc…

As for the filters - how are they exactly supposed to work?
When you select status what should happen and then when you select part status what should happen?


#9

In the video I first show the way it should work, and then after how it currently works with our application. Hope this is clearly shown visually in the video.

I have set the group filter to OR in wappler.


#10

In this case you need these both not in a group, but separate filters.


#11

You mean like this?

This doesn’t work… it won’t filter anymore when I click status or part status.

Or should I enter {{$_GET.status || $_GET.part_status}} somewhere?


#12

Can you try to explain how these 4 filters should work - what should trigger when?
But please don’t just move your mouse around in a video - explain it in a post here.


#13

Looking at your screenshot again, you have wrongly set the filters. It must be setup like this:

So two separate groups, for each GET filter (status and part status). This way you can put separate condition for each of them. My screenshot is just sample, not using the same as your get var names.


#14

That did the trick, thanks!