Forums

Use field as filter in a view

webcrea 06 May, 2017
Hi,
All is in title
A simple dropdown with distinct value of a field to use it to filter results
Regards

ok I found
Max_admin 06 May, 2017
1 Likes
Hi Chris,

You need to configure the where conditions field with the correct condition:

table_field:{data:dropdown_field_name}


Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 06 May, 2017
Thanks
... and if it's an array with multiple select
Regards
Max_admin 06 May, 2017
Hi Chris,


table_field/in:{data:dropdown_field_name}


Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 06 May, 2017
sorry Max, it is not my day🙂

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1

regards
Max_admin 06 May, 2017
Hi Chris,

Which one returned this ? the single value or multiple values ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 06 May, 2017
hi Max
the multiple values
thanks
Max_admin 06 May, 2017
Hi Chris,

The error message does not have any clues, please test with the single value and adjust the dropdown field name, does it work ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 06 May, 2017
With single value

SELECT `fonds`.`id` AS `fonds.id`, `fonds`.`isin` AS `fonds.isin`, `fonds`.`nomProduit` AS `fonds.nomProduit`, `fonds`.`societeGestion` AS `fonds.societeGestion`, `fonds`.`repSG` AS `fonds.repSG`, `fonds`.`natureProduit` AS `fonds.natureProduit`, `fonds`.`visaAMF` AS `fonds.visaAMF`, `fonds`.`dateVL` AS `fonds.dateVL`, `fonds`.`VL` AS `fonds.VL`, `fonds`.`rembAnticipe` AS `fonds.rembAnticipe`, `fonds`.`fondLiquide` AS `fonds.fondLiquide`, `fonds`.`millesime` AS `fonds.millesime`, `fonds`.`dateAgrement` AS `fonds.dateAgrement`, `fonds`.`valeurNominale` AS `fonds.valeurNominale`, `fonds`.`tauxReductISF` AS `fonds.tauxReductISF`, `fonds`.`tauxReductIR` AS `fonds.tauxReductIR`, `fonds`.`tauxPME` AS `fonds.tauxPME`, `fonds`.`zoneGeo` AS `fonds.zoneGeo`, `fonds`.`dateVLorigine` AS `fonds.dateVLorigine`, `fonds`.`limiteSouscription` AS `fonds.limiteSouscription`, `fonds`.`depositaire` AS `fonds.depositaire`, `fonds`.`comComptes` AS `fonds.comComptes`, `fonds`.`dureePlaceConseil` AS `fonds.dureePlaceConseil`, `fonds`.`fraisGestion` AS `fonds.fraisGestion`, `fonds`.`droitsEntree` AS `fonds.droitsEntree`, `fonds`.`droitsGarde` AS `fonds.droitsGarde`, `fonds`.`miniQuantite` AS `fonds.miniQuantite`, `fonds`.`miniMontant` AS `fonds.miniMontant`, `fonds`.`dureeVie` AS `fonds.dureeVie`, `fonds`.`periodicite` AS `fonds.periodicite`, `fonds`.`observation` AS `fonds.observation`, `fonds`.`fiche` AS `fonds.fiche`, `fonds`.`notreSelection` AS `fonds.notreSelection`, `fonds`.`published` AS `fonds.published`, `fonds`.`performance` AS `fonds.performance`, `fonds`.`perfAnnualisee` AS `fonds.perfAnnualisee` FROM `arobas17_fcpi_fonds` AS `fonds` WHERE `fonds`.`published` = '1' AND `fonds`.`societeGestion` = '' ORDER BY `fonds.millesime` DESC LIMIT 30;

the `fonds`.`societeGestion` = '' is empty
Max_admin 06 May, 2017
Hi Chris,

How do you add the dropdown field to the connection ? is it inside a form view ? and where exactly is this view ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 09 May, 2017
Hello Max,

I found, mystake in name field... Sorry

Now, I need include a test in where fields like this

if({data:select_sg}!="") fonds.societeGestion:{data:select_sg}

in fact apply the filter only if not empty...

And How to put a label in the dropdown for the empty value like "select your company"

Reagrds
Max_admin 09 May, 2017
Answer
Hi Chris,

the empty label can be added in the options box like this:
=Select your company


The if not empty check can be like this:

fonds.societeGestion:{data:select_sg}/-

The /- at the end of the value means that the parameter will be skipped if empty.
Or in php:

<?php
if(!empty($this->data("select_sg"))){
return [["fonds.societeGestion", $this->data("select_sg")]];
}


Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 09 May, 2017
Thanks Max
Except for =Select your company
Nothing appears
Regards
webcrea 09 May, 2017

This is private content

Max_admin 09 May, 2017
Hi Chris,

I have just tested this here in a dropdown options:

=test
y=Yes
n=No


The first option has empty value and text = "test"

I also checked your page, the "Nature de produit" is working as expected, the first option is empty.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 09 May, 2017
Yes, and the only one thing is : i declared it first with utf8 char likes éè

clear cache and try to recreate it but nothing,
Regards
Max_admin 09 May, 2017
Hi Chris,

But how do you have the "Nature de produit" working ? how do you have it setup ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
webcrea 09 May, 2017
Thanks Max
yes it woks and filters work well, just label in twice doesn't appear...
regards
This topic is locked and no more replies can be posted.