Re: [iPlanet-JATO] How to make an OR in the WHERE clause of a SELECT

Harry,
If you get a reference to your model, you can set the
whereClauseOverride with exactly the string you want to use. Keep in
mind that you are dealing with a the raw SQL where clause, therefore,
you must use the actual table column names and not the model's logical
field names as they could be different.
QueryModelBase queryModel = (QueryModelBase)getModel(PersonModel.class);
// you must add the "WHERE" as well
String whereClause = "WHERE firstName LIKE '%max' OR lastName LIKE '%max%'";
queryModel.setWhereClauseOverride(whereClause);
Keep in mind that this will override all where criteria: static and
dynamic where criteria. Static criteria can be declared in your model
class: setStaticWhereCriteriaString(STATIC_WHERE_CRITERIA).
You could optionally get the entire SQL statement and replace the
__WHERE__ token yourself with a string replace technique. In fact, if
you want to add an ORDER BY, you will need to get the SQL and append to
the end.
queryModel.getSelectSQL();
Hope this helps. Let me know if you have any questions
craig
hlamer wrote:
Hi,
if I add criterias to my model
with "SelectQueryModel.addUserWhereCriterion()" they will be concated
with AND.
How can I add a criteria with OR?
I want something like:
SELECT personId, firstName, lastName
FROM Person
WHERE firstName LIKE "%max"
OR lastName LIKE "%max%"
Thanks.
Harry
For more information about JATO, including download information, please visit:
http://developer.iplanet.com/tech/appserver/framework/index.jsp

Rewritten your query wuth tags as well
{code}select  "P_CIRCUITS_FIBER"."PORTS_1",
        "P_CIRCUITS_FIBER"."PORTS_2",
        CASE WHEN CPORT.ID = (select REGEXP_SUBSTR(ports_1,'[^,]+',1,1) from p_circuits_fiber)
             THEN "CPORT"."PORT_NO" END PORT_NO_1,
        CASE WHEN CPORT.ID = (select REGEXP_SUBSTR(ports_2,'[^,]+',1,1) from p_circuits_fiber)
             THEN "CPORT"."PORT_NO" END PORT_NO_2
from    "CPORT",
        "P_CIRCUITS_FIBER"
where   p_circuits_fiber.fiber_id = :P4000_CIRCUIT_NO
and     (select REGEXP_SUBSTR(ports_1,'[^,]+',1,1) from p_circuits_fiber) = "CPORT"."PORT_NO"  "PORT_NO_1"
and     (select REGEXP_SUBSTR(ports_2,'[^,]+',1,1) from p_circuits_fiber) = "CPORT"."PORT_NO"  "PORT_NO_2"{code}
Now we can see two columns references which should not be there.
I even not sure to understand why those two conditions are in the WHERE clause. But for sure, CPORT.ID cannot be equal to two values unless they are same.
Is there only one row in p_circuits_fiber ?
Nicolas.

Similar Messages

  • How to make text start at the top of a page in livecycle 9

    Hi, How can I get the text in a large text field to start at the top left of the field rather than at the center of the field? In addition, may one know how to make text wrap in the form as well?
    Thanks,
    David

    To set the Text alignment properties use "Paragraph" pallet you can make it visible by selecting Window>>Paragraph or Shift+F5
    And to allow text wrapping you need to select "Allow Multiple Lines" checkbox under "Object" pallet and "Field" tab. You can make Object pallet visible by selecting Window>>Object or Shift+F7.
    Good Luck,

  • I subscribed for itunes imatch - it works perfectly on my i-pad and iPhone - however on my macbook - my iTunes can no longer find my songs - i don't know how to make it look to the cloud to play my music

    i subscribed for itunes imatch - it works perfectly on my i-pad and iPhone - however on my macbook - my iTunes can no longer find my songs - i don't know how to make it look to the cloud to play my music - i think it keeps trying to find on the external harddrive where i used to keep my music

    Of course iTunes is looking for the music on the external HDD. Enabling iTunes Match does not magically change the location of the iTunes library to the cloud.
    To play the music either plug the external HDD back into your computer or create a new, empty library to use for streaming the iTM content. The latter can be accomplished by holding down the Option key when launching iTunes, choosing "create library" then enabling iTunes Match on the new library. DO NOT have iTunes scan your HDD for music.

  • How to make a restart of the workflow in a process controlled workflow?

    Hi Experts,
    How to make a restart of the workflow in case of process controlled workflow? Scenario is like this:
    The user has created a shopping cart with 1000 USD. The process schema has three process level with the first level being approval with completion.
    The first level being executed by the responsible purchaser. Here, the purchaser adds the source of supply and changes the price of the shopping cart 2000 USD and approve the shopping cart.
    Now, I want the approval task to start from beginning so that the requestor can know the changes and accept/reject the changes.
    Thanks and regards,
    Ranjan

    Hi,
    Restarting workflow goes to 1st level approval step. It is not requester.
    I think you need to set condition for "Acceptance by Contact Person" in Define Process Level.
    Regards,
    Masa

  • How to make a custom template the default for Apple Mail (10.7.5)?

    Hi,
    I'm OK with making a new custom template in Apple Mail.  It shows up fine once under "custom" in the stationary pane (and once I take off signature in a new email).  But... that's a lot of trouble to go through everytime I want to send an email.
    So the question is: can I make my custom template my default for all my emails, unless I want to manually change it?  Seems like this should be possible but I can't figure it out and haven't run into any solutions (only on how to make a template).
    Do I really have to select it each time?
    Best,
    Joel

    As an FYI: I just solved the problem by going the "low road." I'll be a bit laborious in case someone else wants a solution at a later date (I know I Googled the topic and found nothing). I experimented by simply:
    Opening a new email message
    Selecting my custom template
    Copying the custom signature (Select All)
    Opening another new email message
    Selecting Edit on the Signature pulldown menu
    Hitting the plus symbol to create/add a new signature in the pane
    Pasting into the new signature
    Naming it
    Selecting "Choose signature" at the bottom of the signatures pane
    And violà!!
    It now appears as a possible selection *and* as the default.
    Better yet - it is now my default and will work as a reply to an email.
    I think I got it all right in the list above.
    OK, granted, this is a pretty simply signature - a list of my website, SoundCloud, twitter etc with those names in bold and a graphic of my color logo - but... it works! YMMV.
    Give it to Apple to make it so simple that any fool could do it (that would be me), you wouldn't need a "specialized" app, and - of course - there wouldn't even be instructions on how to do it!
    Best,
    Joel

  • How to make a backup if the Storage & Backup icon is missing?

    how to make a backup if the Storage & Backup icon is missing?

    http://www.apple.com/icloud/setup/ios.html
    Sounds like you have an account, so two options I would say.
    Try turning it off, then off and see what options you get, or sync your phone to iTunes and click on the summary and choose the iCloud option.

  • How to make JDev aware of the xmldb API

    Hi everybody,
    I am a real beginner in Jdev, and I have to develop a
    Java Application using Oracle Java developer, against
    an XML-native database called eXist. I'll have to use
    a java API called xmldb supported by eXist in order to
    interact with the database. Although I have basic
    knowloedge in Object-oriented programming, but I don't
    know where to begin, especially how to make JDev aware
    of the xmldb API, and how to create classical
    application components (Windows, buttons, etc).
    Could you help me with some orientations and
    interesting links?.
    Thanks a lot.
    Mounir.

    Hi,
    don't know this database, but the database vendor should be able to explain how his DB is accessed from Java. If this requires libraries, then the vendor will provide these in JAR files, which you then configure with JDeveloper (as a custom library Tools --> Manage Libraries) or in the Project
    If there is a JDB driver for it, even better. This however is not a deliverable of JDeveloper but the database vendor
    Frank

  • How to make every account in the system login automatically?

    How to make every account in the system login automatically when Mac OS X startup?
    Thanks!

    I can see one way to do it. You'll need to install a script in each user account, and have it set as a login item for each user. Let's imagine you have three user accounts. Each user in Mac OS X has a UID number. Normally your first user has the UID of 501, the second one will be 502 and so on...
    You can determine the UID by running the following AppleScript while logged in on each user:
    do shell script ("ID")
    This'll return a long block of text, but right at the start you'll see the UID number. Let's assume your three users have the UIDs 501, 502 and 503. We begin with 501.
    Create the following script and save it as an application while logged in as 501. Note that the password you're entering is the password for UID 502. Also note that the forum system is creating line breaks where there shouldn't be any. The long "do shell script" line should be one line.
    delay 5 --This delay allows time for login to complete, but it may not be necessary.
    try
    do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 502"
    delay 5 --This delay could be shorter or longer, depending on how fast your machine is.
    tell application "System Events"
    keystroke "password for 502" --the password for UID 502
    keystroke return
    delay 1
    end tell
    on error
    display dialog "Unable to switch user."
    end try
    Open System Preferences, go to Accounts, click "login items" and drag your script (saved as an application) to the login items window.
    You basically repeat this process for each user account, modifying the script so it switches to the next user.
    This isn't ideal, because your passwords will be stored in the scripts, and each user could open the scripts and learn the passwords of the other users on that machine.
    I picked some of this up from a discussion over at the Macworld forums:
    http://hints.macworld.com/article.php?story=20031102031045417
    Message was edited by: The Preacher
    Message was edited by: The Preacher
    Message was edited by: The Preacher

  • HT4623 How to make Google Maps as the default Map App in my iPhone 5

    How to make Google Maps as the default Map App in my iPhone 5, so that I could still use the old bookmarks and use the pins to drop, Please assist.

    You cannot make Google Maps the default mapping app.

  • How to make Excel, Word, Powerpoint the Default programs?

    Hey guys,
    Just got my new MBP, and I need to know how to make Excel, Word, Powerpoint the default programs when opening one of their files? Currently, the trial version of Iwork opens the programs which drives me crazy.....
    So, for example, for an Excel file, I want Excel to open it, NOT Numbers......etc....
    Thanks In advance.
    JW

    Select a file of that type in the Finder, choose Get Info from the File menu, change the Open With entry for it to the desired application, click on Change All, and confirm the action.
    (47808)

  • I reset my phone and it now receives calls that were meant for my husband. I know how to fix this with messaging and facetime, but can't seem to find how to make it stop with the calls. Please help.

    I reset my phone and it now receives calls that were meant for my husband. I know how to fix this with messaging and facetime, but can't seem to find how to make it stop with the calls. Please help.

    It may be due to Continuity
    The following quote is from  Connect your iPhone, iPad, and iPod touch using Continuity
    Turn off iPhone cellular calls
    To turn off iPhone Cellular Calls on a device, go to Settings > FaceTime and turn off iPhone Cellular Calls.

  • How to make Nokia Suite remember the position and ...

    how to make Nokia Suite remember the position and the size i set it?
    because everytime i start it, it defaults in the middle of the screen and in the smallest possible size.
    Nokia Suite 3.3.86
    Windows Vista
    Greece Nokia X6 RM-559 v40.0.002

    Again, are you talking about genuine Nokia firmware, not any of some 3rd-party customised versions?
    For officially released firmware, you may force Nokia Suite to reinstall even if your firmware is already up to date. This feature might be missed in its GUI as its link is "hidden" in the prompt message, not on a button or highlighted with underscore. Try Nokia Suite, once the phone is connected, click the icon of Software Update on the top, then click the word "reinstall" in the prompted message.
    bbao
    * If this post helped you, please click the white Kudo star.
    * If this post has solved your issue, please click Accept as Solution.

  • How To Make My New MacBook The Main Base Of My iPad, iPhone?

    I just got my new MacBook Pro, and i'm transefing all my applications for iPad and iPhone, music and my photos to my new computer using a Seagate Hard Drive. Anyway, i connected my iDevices to my computer and i do not know how to make this computer be the Mac that transfes everything instead of the old one. When i go to my iPad settings, under general, i go to Wi-Fi Sync and it says i can sync it when 'GABE' is available (that is my old computer). I want it to be my new one and be able to sync with no problems and without loosing my imformation from my iPad and iPhone apps. (For example, i don't wanna loose Pages documents, Garageband songs and FL Music Studio files)
    Please help, if you have any questions into what i need please ask, this is a hard question to explain! Thank you so much.

    That's fine as long as you never want to host any other content on www.domain.com
    Personally I would have setup a separate site such as webmail.domain.com that points to the Squirrelmail directory, and setup a redirect so that hits to the top page of www.domain.com get redirected to the webmail site.
    That way you preserve www.domain.com to still be free for other web content, yet still make it easy for users to get to webmail.

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • How do I modify the WHERE clause in my SQL query?

    This seems like such a straight-forward part of the report design, but I'm fairly new to Crystal Reports and I only have experience with modifying reports someone else has already written.  In this particular case, I just need to modify the WHERE clause of the SQL query.  I can select Show SQL Query and see what statement is being used to select data, but I can't find where to modify it since it's grayed out.  I see how to change the selection criteria, parameters, grouping, etc...just not the WHERE clause.  The report is linked to a database used for reporting with a table created and populated by a stored procedure.  I don't need to modify the stored procedure because the data I want to filter by is currently in the table--I just don't know how to filter by what I need.  Here's part of the query:
    SELECT "rpt_dist"."startdate", "rpt_dist"."transtype", "rpt_dist"."laborcode", "rpt_dist"."crewid", "rpt_dist"."regularhrs" FROM   "Reporting"."dbo"."rpt_dist" "rpt_dist"
    WHERE  (rpt_dist."transtype" <> 'WORK' AND rpt_dist."transtype" <> 'WMATL') AND rpt_dist."laborcode" LIKE 'S%' AND (rpt_dist."crewid" = 'HOUS' OR rpt_dist."crewid" = 'HOUS2' ...
    I would like to add another crewid to the WHERE clause.  Thanks for any input.

    1.Open the report in the crystal designer
    2.Go to the field explorer(if hidden go to view menu->field explorer)
    3.Rt. click on the database fields->choose database expert
    4.Now you will see 2 columns-Available DataSource  and Selected Tables
    5.Rt. click on the object(ex.command) available in the Selected Tables column->Choose Edit command
    6.A new Modify Command window will appear,here you can edit your SQL Query
    I get to step 4 and I see the two columns including my database and the report table, but there is no command object available.  If I right-click on my table, I can just view the Properties. ??
    As for the other tip to modify the record selection:  I don't see anywhere the other crewid values are set and if I add the one I'm missing, it doesn't modify the existing SQL Query and when I preview the report it throws off the results so that no data displays??
    I'm using Crystal Reports 11.5 if that makes a difference.  Thanks again.

Maybe you are looking for