Protocol Query

rafaelscouto 08 Feb, 2019
Good afternoon

How do I create a query field, where I can enter a protocol number, which is already stored in the database, and return only the data for this protocol to me?Protocol Query image 1
healyhatman 08 Feb, 2019
Put field:{data:fieldname} in the where conditions of the data read.
rafaelscouto 09 Feb, 2019
I would like to understand, in detail, how to do this?

I created a "Search" via the Widget / Search, not the button when typing the protocol number, return the data, as it is in the debug below. Everything is going well, but how can I view this data?

Is there a better way to do this? Example, when typing in the search and clicking the button, it redirect to a page with this data.

My read_protocol is set like this:
Data Settings
All matching records
Array
(
    [read_protocolo] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Prot`.`aid` AS `Prot.aid`, `Prot`.`created` AS `Prot.created`, `Prot`.`modified` AS `Prot.modified`, `Prot`.`nome` AS `Prot.nome`, `Prot`.`celular` AS `Prot.celular`, `Prot`.`email` AS `Prot.email`, `Prot`.`secretaria` AS `Prot.secretaria`, `Prot`.`regiao` AS `Prot.regiao`, `Prot`.`assunto` AS `Prot.assunto`, `Prot`.`midia` AS `Prot.midia`, `Prot`.`descricao` AS `Prot.descricao`, `Prot`.`protocolo` AS `Prot.protocolo` FROM `udgtx_z_ouvidoria-cadastrar` AS `Prot` WHERE `Prot`.`protocolo` LIKE '%201902000040%' LIMIT 100;
                )

            [var] => Array
                (
                    [0] => Array
                        (
                            [Prot] => Array
                                (
                                    [aid] => 40
                                    [created] => 2019-02-08 11:19:12
                                    [modified] => 
                                    [nome] => teste
                                    [celular] => (74) 98819-9939
                                    [email] => 
                                    [secretaria] => SMEDUC
                                    [regiao] => TIQUARA
                                    [assunto] => SAÚDE
                                    [midia] => 
                                    [descricao] => teste de msg
                                    [protocolo] => 201902000040
                                )

                        )

                )

        )

)
healyhatman 09 Feb, 2019
Need a table view. Have you looked at the demos?
rafaelscouto 09 Feb, 2019
This way I will display all the data as a list in a table, but I do not want it that way, because this data can not be exposed and can only be accessed through a special protocol number.

I need to do it in a way that only that particular protocol appears when it is searched.

Please explain in detail how I can solve
healyhatman 09 Feb, 2019
Well if you're only displaying one item you could set the read_data to return first matching.

But all the data you need is right there.
{var:index.model.field}
So if you put in a HTML block , because you have it set to return all matching:
{var:0.Prot.nome}
It will print "teste". If you have it set to first matching you won't have the index.

By the way if all you need to do is enter a code into a box and bring up the data for only that code, you don't need to use Chronoconnectivity, You can just do it in Chronoforms if that would be easier for you.
rafaelscouto 09 Feb, 2019
Exactly!

I want to create a field and a button

When entering the protocol number, display the data relating to it.

How can I do it?
healyhatman 09 Feb, 2019
Answer
Do it in Chronoforms then, I get the feeling CC might be too complicated for you.

Have a field and a button. In the submit event have a read_data action, set to first matching, in the where conditions you can put
protocol:{data:protocol}
And then I gave you the reset of the information you need. Just make a table out of HTML or however else you want to display it, the values will be
{var:read_data#.model.field}
rafaelscouto 09 Feb, 2019
Many thanks for the tips! Worked on CF and CC
This topic is locked and no more replies can be posted.