I have a problem to validate the fields for research and would like to know if anyone has passed through this and how it solved it. I always valued the fields for research or even to register with the following syntax: ": block.campo is null", but I have a situation now, that this validation is failing. When I type for example "123456" in the field and research, the above validation works, however, if I put the percentage%, example
I even have the solution, but I'm sure not the solution I thought, it's not part of good practices. I thought about doing so "Length (: block.Campo) = 0", but I wanted to know if there is any other solution or if you have a better solution !!!
In fact, my problem today is as follows, there is already a "pre-query" trigger in a base-table block, which verified if the fields are filled or not, if they are not , it gives a message and does not perform the search. When I type for example on an item "123456", it does the search / search normally, however, if I put the percentage "%" in the item to do the research, example "12345%", he understands how the field was Empty and does not fulfill the search. But the customer needs / wants to carry out the search with the "%".
I do not know if you have forms in hands there, but to view my problem, just create a forms with a simple base-table block (code, description) and put on trigger "Pre-Query" block the validation below and try to carry out the search in code with the "%".
I am not mounting the query or sets the default_where of the block, the search is using the "F7" and "F8".
Yesterday before sending the email, I tested the Length and it worked, but today it is not working, that is, any / bulto-in function that I use with this Number field containing the "%", it does not work.
I can not let the client do a search without at least 1 field as a criterion (filled), that is, if he reaches the block, press "F7" and then "F8", I can not allow, it has to fill at least 1 field and if it uses the "%".
No .. I do a simple forms with a simple base-table block ... look at this image
[IMG [0]]
Make a similar forms, just need an item number ... then you run it and do a search ... in trigger validation, he should show the message only when we squeeze f7 and soon Then F8, to bring all * the data, correct ??? However, when you enter any number with the "%", it gives an error of 50016 if I am not mistaken and zero the item, understand?
So if the block is base table, the user types something and clicks F7, the forms will validate the registry.
He understands he was trying to insert something.
That's why the 50600 error.
Probably the field is Number and the user typed%.
DAI tries to validate and the error
can you use the usual process?
F7 key, the block enters search mode, the user types in the field that he wants the value with or without% and F8 key.
Dai does not even need pre-query.
But in this situation does not have to create pre-query, it is natural for the forms to perform the search and respect what was typed ...
You tried Run the forms without creating pre-query?
I need to create because I can not let the first situation happen, because it brings all the records of the table and this delays ... understood why the pre- Query ???
So ... but I do not know if the validation it has is because of the amount of records (which was what happened to me), or if it is some business rule not to allow consultation without any filled field.
As for the "problem" of the percentage "%", it gives a 50016 error when you try to search in numeric field, * probably * it gives the mistake and zera the field, so with which The condition of the field is null. That's what I think, but I'm not sure.
Dude, I laughed at your "time has come to appeal to ignorance" ... What I thought was in treating the error in "On-Error" with the following "logic" ... if it gave invalid error, It's because the field is not null ... tended ??
But even with the search block, the situation would be the same would not be? Would have an item in this Number block that the user would put the "%" and would give the same error
Declare
v_clau varchar2(2000);
begin
if :controle.valor is null then
message('Query full não permitida!');
pause;
--
raise form_trigger_failure;
--
else
if :controle.valor like '%' then
message('Query com %!');
pause;
set_block_property('cliente_proprietario', default_where, 'cliente_proprietario.cd_Clie_Fili like '||''''||:controle.valor||'''');
else
message('Query informada!');
pause;
set_block_property('cliente_proprietario', default_where, 'cliente_proprietario.cd_Clie_Fili = '||:controle.valor);
end if;
end if;
end;
First excuse for the delay, I made a simple test forms here with the non-base-table block and even then it did not roll ... Take a look there for you to see how I do it here , because I do not ride the default_where, understood? https://drive.google.com/open?id=0B2SBc ... XU3UFpCS0U
I managed to download the file but it opens with error, it must be a lack of some PLL here, or something like that.
I am attaching the test I did and with the creation script of a table that I used with some inserts.
Renames the file to .zip and see if you can see the way I did.