Search with Multiple Choice problem
Fred
I use these Formula and work but the problem is I have only 3 items in the table Tipo de Documento and need to use aleatory case number. I try one by one I'm lucky to find the case number, and if I insert another Tipo de Documento have problems.
switch number(Busqueda) do
case 1:
(select Documentos where 'Tipo Documentos'.Clase = "Plano" and 'Ganado REAL' = null)
case 4:
(select Documentos where 'Tipo Documentos'.Clase = "Actividad" and 'Ganado REAL' = null)
case 8:
(select Documentos where 'Tipo Documentos'.Clase = "Documento" and 'Ganado REAL' = null)
end
26 replies
-
Hi Rafael -
Are you saying that you should have found more than 4 records when searching:
'Tipo Documentos'.Clase = "Plano" and 'Ganado REAL' = null
When you say:
I try one by one I'm lucky to find the case number
Do you mean you don't know how to find the choice numbers for the field Clase?
-
Fred
The formula give me the good result.
The problems is with the case number, the first time don´t work with
case 1
case 2
case 3
Then I try to find what case will work and work the case 1 , case 4 and case 8 and I case only 3 Tipo de Documentos, and if insert a new Tipo de Documentos de case 4 not work.
I don´t know how to find the case the choice number
-
Ok, so you are switching on the field Busqueda. Is that a simple choice field? or a Dynamic choice field?
If it is a simple choice, then the choice numbers are there when you edit the choice field.
If it is a dynamic choice, then the numbers are the record Id in the table.
-
Fred
Is a Multiple Choice Dynamics, in the Table the id number are in the picture, but with these numbers the case don´t work.
-
Fred
I send you again the DB.
The table Tipo de Documentos is the Table with the 3 kind of documents maybe there will be more.
In the Table Documentos in the Tab Busqueda you will find the Multiple Choice.
-
I was wrong about the dynamic multichoice field. When you use number() it does not give the record Id number when you select multiple choices.
FYI, if you use numbers (ending with "s") then you an array of the record Ids.
Here is one solution but only works if you have a 3, maybe 4, choices. The combinations grow to large when there are more choices. Maybe someone smarter than me can figure out a solution that can handle a larger choice selection.
let x := text(Busqueda) let check1 := if x like "Plano" then 1 end; let check2 := if x like "Actividad" then 2 end; let check3 := if x like "Documento" then 4 end; let mode := check1 + check2 + check3; switch mode do case 1: (select Documentos where 'Tipo Documentos'.Clase = "Plano" and 'Ganado REAL' = null) case 2: (select Documentos where 'Tipo Documentos'.Clase = "Actividad" and 'Ganado REAL' = null) case 3: (select Documentos where 'Tipo Documentos'.Clase = "Actividad" and 'Tipo Documentos'.Clase = "Plano" and 'Ganado REAL' = null) case 4: (select Documentos where 'Tipo Documentos'.Clase = "Documento" and 'Ganado REAL' = null) case 5: you can fill in here case 7: you can fill in here end
Since you are using a dynamic multi choice (dMC) we have to convert the information into usable data. Again, this is one solution and not very dynamic . So line 1 takes Busqueda and turns it into text. Lines 2-4 creates a variable that checks for each type and assigns a number value.
Line 5, adds up the newly created variables into a new variable so we can use the switch function depending on their sum.
Line 6 - 19 is where all the magic happens. I think you can figure out the relationship between the case and the search you need to do.
I hope this helps and maybe someone will come up with a solution that scales better.
-
I had a look at your database, and devised the following formula to fill the view:
let b := numbers(Busqueda); (select Documentos)[( let t := number('Tipo Documentos'); cnt(b[= t]) ) and 'Ganado REAL' = null]
This formula works without the need to enumerate the various choices, and without making reference to the names of the document types. One can thus add or remove records in the "Tipo Documentos" table, or change the values in the "Clase" field without needing to change the formula.
-
Alain Fontaine
Fred
I really appreciate your help without this help this would not have come out.
Great support I hope this BD that I have shared helps other new ones.
-
Fred
Fred why I can't view the table in this table ?
-
I can,t see on FECHACORTE the Table with the fields.
Some Enable and Disable the > ( near the name table) for view the table.
-
1) click on the + and type in a name for the view and select form
2) ctrl+click on the all view and select Delete View
now you only have 1 view.
Also dashboards only have 1 record so there is no need for a table view.
Content aside
- Status Answered
- 2 yrs agoLast active
- 26Replies
- 259Views
-
3
Following