Author Topic: CMOD Java Query  (Read 3005 times)

JANDL

  • Newbie
  • *
  • Posts: 3
    • View Profile
CMOD Java Query
« on: March 12, 2019, 05:30:41 AM »
Hi There,

I have some java code that searches for documents on CMOD. The issue I'm having is that the attribute name spelling I filter on is different than what I see when I do "getApplicationGroup" call to retrieve the list of attributes I can search on.

For example, lets say I have a Folder called "MyTransactions"

I create my ODServer object, connect and then call getApplicationGroup for "MyTransactions".
I call getFields and loop through the fields for that Folder.

Field:
TransactionGUID
TransactionDate

So now that I have the two attribute I can populate them and search CMOD for the documents.

I open up my ODFolder for "MyTransactions" and set the two criteria  :

TransactionGUID = "123"
TransactionDate = "SomeDate"

I then do a search() and get results for a different date than what I specified in TransactionDate.

I played around with this a bit and seems like the search only works if I have a space between e.g. "Transaction Date" but in the getApplicationGroup call the attribute name is without a space. So far this is only true for this one attribute, the rest works when using the attribute name from the getApplicationGroup call.

Any ideas on this? I hope it makes sense..

Cheers,
Jan





Alessandro Perucchi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
Re: CMOD Java Query
« Reply #1 on: March 12, 2019, 01:41:03 PM »
Hello Jandl,

Welcome to the forum!

So, with a small code example, it would have been perfect.
I will try to decrypt your question. So you have done a small test in Java with the OD API in order to search for some documents, and you are using the ODCriteria in order to search for your documents.
You are not using some SQL WHERE clause for that.

Is this correct? If yes, then you need to know that the ODCriteria use the Folder Field name to do the search.
If you use the SQL WHERE clause, then you need to use the Application Group field name.

Let say you want to search with the ODCriteria, then when you search with a date field, you must make sure that you are using the correct date format, other you might search for a different date. To know which format to use, you need to get the date format with the method ODCriteria.getDefaultFmt(). It use the same format that setup in CMOD with the %Y, %y, %M, etc...

If you are searching with the SQL where clause, then this document might of interest: https://www-01.ibm.com/support/docview.wss?uid=swg27036188

I hope what I've written is clear, otherwise I will try to be more explicit :-)

Cheers!




Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML

JANDL

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: CMOD Java Query
« Reply #2 on: March 12, 2019, 09:11:27 PM »
Hello Jandl,

Welcome to the forum!

So, with a small code example, it would have been perfect.
I will try to decrypt your question. So you have done a small test in Java with the OD API in order to search for some documents, and you are using the ODCriteria in order to search for your documents.
You are not using some SQL WHERE clause for that.

Is this correct? If yes, then you need to know that the ODCriteria use the Folder Field name to do the search.
If you use the SQL WHERE clause, then you need to use the Application Group field name.

Let say you want to search with the ODCriteria, then when you search with a date field, you must make sure that you are using the correct date format, other you might search for a different date. To know which format to use, you need to get the date format with the method ODCriteria.getDefaultFmt(). It use the same format that setup in CMOD with the %Y, %y, %M, etc...

If you are searching with the SQL where clause, then this document might of interest: https://www-01.ibm.com/support/docview.wss?uid=swg27036188

I hope what I've written is clear, otherwise I will try to be more explicit :-)

Cheers!


Hi There,

Thanks very much! This helps allot. I will give it a try and give some feedback.

Cheers


Jens Hildebrandt

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
    • 10m GmbH
Re: CMOD Java Query
« Reply #3 on: May 06, 2019, 12:28:00 PM »
hi there,

maybe this will simplify your life: https://confluence.10m.de/display/ODC/Searching

Re. Jens