Switch

How to conditionally show a button based on a data query result.

Overview

The issue occurs when trying to display a button only if a query returns a valid ID.
Use a Switch element with the data provider set to check if the query result is empty, then map the true/false outcomes to control the button visibility.

Answered
Connectivity v6
we webcrea 19 Jun, 2017
Hi,

I would want to show a button in function of value of a data query :
- I create the query (read data) and the result return an id
- I create a switch where data provider is the read_data

And I would want if the return value is > 0 (id exists) return true else return false

Do you have an idea?

Regards
Max_admin Max_admin 20 Jun, 2017
Answer
Hi Christophe,

Assuming the read data is named "read_data1", you can use this in the Switch settings:

Data provider: {var.empty:read_data1}
Values:
true:No results found
false:We found something


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.