Page 1 of 1

dbpQuery

PostPosted: Wed Jul 30, 2008 3:07 pm
by phenix37
Hello all,

I'm trying to use this code:
Code: Select all
 dbpQuery "[base_id]" "[choix_dans_liste_table]" "[Choix_champs] LIKE [#34]%[texte_chercher]%[#34] [ORAND] [Choix_champs2] LIKE [#34]%[texte_chercher]%[#34]"

With the content of variables:
Code: Select all
 dbpQuery "base_id" "TABLE" "FIELD1 LIKE "%text_to_word%" OR FIELD2 LIKE "%text_to_word%" "

But it does not work.
Where do I commit a mistake?
Thank you.

PostPosted: Wed Jul 30, 2008 4:06 pm
by Gaev
Geo:
But it does not work.
You do not say what actually happened ? ... did NeoBook return an error ? ... were zero records selected ? ... were all records selected ?

Code: Select all
dbpQuery "base_id" "TABLE" "FIELD1 LIKE "%text_to_word%" OR FIELD2 LIKE "%text_to_word%" "

a) I am assuming the double quotes at the very end is just a typographical error on this forum article ... and not in your pub.

b) Did you try and use this "hard coded' version of the command ?

c) Your Table is called "TABLE" ? ... this is a reserved word ... try using another name e.g. Table1

d) LIKE "%text_to_word%" ... please note that the underscore is a wild card character ... from the Help file ...
Code: Select all
Another wildcard is the underscore character (_) which can be used to represent any single character. For example:

LastName LIKE "sm_th"

will find "Smith", "Smyth", "Smath", "Smeth", etc.
... hopefully you are looking for content matching ...

"any number of characters"
... followed by the exact text string "text"
... followed by "any one character"
... followed by the exact text string "to"
... followed by "any one character"
... followed by the exact text string "word"
... followed by "any number of characters"

dbpQuery

PostPosted: Wed Jul 30, 2008 4:45 pm
by phenix37
thank you Gaev.
I badly expressed.
I have this command. Pub
Code: Select all
dbpQuery "[base_id]" "[choix_dans_liste_table]" "[Choix_champs] LIKE [#34]%[texte_chercher]%[#34] [ORAND] [Choix_champs2] LIKE [#34]%[texte_chercher]%[#34]"


I use variables that are assigned previously.
The result seems to ignore the 2nd assertion.

If I'm looking for a value in the first field and the second with the operator OR
The result does not return records of the second operator.

Here is an example of the search page.

PostPosted: Wed Jul 30, 2008 5:27 pm
by Gaev
Geo:
If I'm looking for a value in the first field and the second with the operator OR
The result does not return records of the second operator.

In your pub, you have ...
Code: Select all
if "[exact_contient]" "=" "Contient"
 if "[case_champs2]" "=" "Checked"
    dbpQuery "[base_id]" "[choix_dans_liste_table]" "[Choix_champs] LIKE [#34]%[texte_chercher]%[#34] [ORAND] [Choix_champs2] LIKE [#34]%[texte_chercher]%[#34]"
 else
    dbpQuery "[base_id]" "[choix_dans_liste_table]" "[Choix_champs] LIKE [#34]%[texte_chercher]%[#34]"
 endif
endif


You have a CheckBox object named Case_champs2 ... but its Variable: (to store button status) is [champs2] !!! ... so the second dbpQuery command is serviced ... not the first !!! ... so, either change the name of the associated variable ... or change the variable referenced in the second If command.

PostPosted: Thu Jul 31, 2008 12:59 am
by phenix37
Gaev wrote:Geo:
You have a CheckBox object named Case_champs2 ... but its Variable: (to store button status) is [champs2] !!! ... so the second dbpQuery command is serviced ... not the first !!! ... so, either change the name of the associated variable ... or change the variable referenced in the second If command.


Hello Gaev.

Excellent!
What error inattention!
Thank you very much.