| View previous topic :: View next topic |
| Author |
Message |
peetieq2 General User

Joined: 27 Aug 2009 Posts: 6
|
Posted: Thu Aug 27, 2009 8:11 am Post subject: [SOLVED] wild cards and parameters |
|
|
I want to do the following thing:
I want to find all the words that contains a certain character but I want the character as a parameter, so:
letter? for instance q and then I want to find all the words with a q in it.
In MS ACCESS you can use the code:
Like '*' & [char] & '*' but that doesn't work in Open Office.
What is the correct syntax for this problem in OO?
thanks!
Last edited by peetieq2 on Thu Aug 27, 2009 12:48 pm; edited 1 time in total |
|
| Back to top |
|
 |
Sliderule Super User


Joined: 29 May 2004 Posts: 2474 Location: 3rd Rock From The Sun
|
Posted: Thu Aug 27, 2009 8:30 am Post subject: |
|
|
peetieq2:
Welcome to OpenOffice Base.
You are asking about using Parameter Queries.
Please see the link below, that contains both an explanation, AND, graphics on how to accomplish what you want.
http://www.oooforum.org/forum/viewtopic.phtml?t=86096
I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your first post title ( edit button ) if your issue has been fixed / resolved. |
|
| Back to top |
|
 |
peetieq2 General User

Joined: 27 Aug 2009 Posts: 6
|
Posted: Thu Aug 27, 2009 9:27 am Post subject: |
|
|
I'm sorry, but it doesn't work! He says that || are not allowed
I did exactly as you told: Like '%' || :char || '%'
The first part it went well: i got a popup for me parameter, but then he said that he couldn't match the input with the syntax with ||
|| not allowed, he said  |
|
| Back to top |
|
 |
Sliderule Super User


Joined: 29 May 2004 Posts: 2474 Location: 3rd Rock From The Sun
|
Posted: Thu Aug 27, 2009 9:53 am Post subject: |
|
|
peetieq2:
| peetieq2 wrote: | The first part it went well: i got a popup for me parameter, but then he said that he couldn't match the input with the syntax with ||
|| not allowed, he said |
Could be a couple of things . . . what version of OpenOffice are you using?
Starting with OpenOffice 2.4 ( and later ) . . . the || can be used for 'concatenation' . . . whereas prior to this version, had to use multiple "concat(field_1,field2)" statements. Please see:
http://www.oooforum.org/forum/viewtopic.phtml?t=69980
Also, and, more likely, as of OpenOffice 3.1, a 'major' improvement ( yes, that is MY description ) . . . see this link:
http://wiki.services.openoffice.org/wiki/Base/New_features_in_3_1#Parameters_recognized_in_function_argument_lists
What the above means is . . . yes . . . as of OpenOffice 3.1, it should work. If you are using OpenOffice 3.0, or before . . . I would recommend you update to 3.1 . . . OR . . . you could use this:
| Code: | | LIKE :Input_PCT_char_PCT |
and have the user INCLUDE a Percent(s) as part of the response. For example, user would be required to input: %e%
I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your first post title ( edit button ) if your issue has been fixed / resolved. |
|
| Back to top |
|
 |
peetieq2 General User

Joined: 27 Aug 2009 Posts: 6
|
Posted: Thu Aug 27, 2009 10:14 am Post subject: |
|
|
I use 3.1 and I tried the construction with concatenate, the result:
He recognized the parameter, but when i filled it in, he said that there was un unknown word Concat, so it doesn't work
 |
|
| Back to top |
|
 |
Sliderule Super User


Joined: 29 May 2004 Posts: 2474 Location: 3rd Rock From The Sun
|
Posted: Thu Aug 27, 2009 10:18 am Post subject: |
|
|
peetieq2:
OK, one more question, what is the database engine you are using with OpenOffice Base?
You can confirm this, after opening your database file, by looking at the 'status bar' at the bottom.
I was assuming ( perhaps incorrectly so ), that you are using the 'default' HSQL engine.
Sliderule |
|
| Back to top |
|
 |
peetieq2 General User

Joined: 27 Aug 2009 Posts: 6
|
Posted: Thu Aug 27, 2009 10:46 am Post subject: |
|
|
I see at the bottom "Microsoft Access" and C:\Users\....\orgsc.mdb
, is that what you mean? |
|
| Back to top |
|
 |
Sliderule Super User


Joined: 29 May 2004 Posts: 2474 Location: 3rd Rock From The Sun
|
Posted: Thu Aug 27, 2009 11:11 am Post subject: |
|
|
OK, since you are using OpenOffice with Microsoft Access as your database engine . . . this is how to accomplish your task.
In the example below, using an Access Database file, I wanted to 'search' the field Description and to prompt the user for the search string. The user will be required to also enter a % around the search string. Since, the Prompt must begine with a colon ( : ) and be one word with NO SPACES, I like to include as part of the prompt, the reminder to the user to include %. So, I used:
| Code: | | LIKE :Enter_Pct_Character_to_serach_Pct |
on the Criterion Line.
Just as an FYI, if you were to write this as SQL, it would look like this:
| Code: | SELECT
`Group Time`,
`Description`,
`Description 2`
FROM `GRPTIME` AS `GRPTIME`
WHERE `Description` LIKE :Enter_Pct_Character_to_serach_Pct |
I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your first post title ( edit button ) if your issue has been fixed / resolved. |
|
| Back to top |
|
 |
peetieq2 General User

Joined: 27 Aug 2009 Posts: 6
|
Posted: Thu Aug 27, 2009 11:39 am Post subject: |
|
|
Ok, this works, but it is not the solution I aimed for
What is the reason that he cannot cope with parameters and wild cards in one query?
Do you think in the future it will be possible to combine them in one expression? |
|
| Back to top |
|
 |
Sliderule Super User


Joined: 29 May 2004 Posts: 2474 Location: 3rd Rock From The Sun
|
Posted: Thu Aug 27, 2009 12:15 pm Post subject: |
|
|
peetieq2:
Since, you indicated that "this works", I would appreciate it if you could please add [Solved] to your first post, as indicated at the bottom of all of my posts. This is so others searching forum posts will understand that 'a solution' has been found. Thanks.
You asked:
| peetieq2 wrote: | | What is the reason that he cannot cope with parameters and wild cards in one query? |
OK, I do not know how computer knowledgeable you are, but, I will attempt to explain.
What is happening in the background . . . OpenOffice Base will 'parse' the Query you are creating, and, determine what it needs to do. This may include things like, 'changing' dates entered in 'local format' ( for example, MM/DD/YY, DD/MM/YY, MM.DD.YYYY, or, DD.MM.YYYY into a database required format of YYYY-MM-DD. Also, while 'parsing' the Query, it will determine if a Parameter Query is written ( beginning with a colon : ) and provide the 'prompt' for the user, and, replace this into the SQL needed to run the Query.
But, different database engines might use different syntax, such as for concatenation. The SQL standard is two pipe character, || , as used by HSQL ( the 'default' embedded database engine ), but, you are using Microsoft engine, that is NOT SQL compliant, where the 'concatenation' character is & . While 'parsing' your Query with this non-compliant character string, the parser will report this as an error.
You asked:
| peetieq2 wrote: | | Do you think in the future it will be possible to combine them in one expression? |
I am not an OpenOffice developer, but rather just a user, and, I have not looked at the 'open issues' to see if this anyone else has reported it as an issue. If you wish, you could search for it, and, if necessary, either vote for it ( assuming someone else has reported it ), OR, open a new issue.
The links below is where you can read about posting / reading such issues:
- How to Start: http://qa.openoffice.org/ooQAReloaded/Docs/QA-Reloaded-HowToStart.html
- Issue Tracking Query: http://qa.openoffice.org/issues/query.cgi
Sliderule
Thanks to add [Solved] in your first post title ( edit button ) if your issue has been fixed / resolved. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|