10 Replies Latest reply on Jan 29, 2015 7:52 AM by Ben Hill

    Remedy 8.1 Java API query issue

      Share This:

      Using the Java API to query schema tickets I have run into a odd behavior. It's quite possible the problem is in our code but I wanted to see if anyone has seen this problem. All these queries are from the Sample:Classes schema.

       

      Take the core field Status query for the value 2. The query will work in the Remedy advanced query builder.

      ('Status' = 2)

      This will fail using the Java API with an error of 1588. Value 2 is not in the range of valid values. Now here is the weird part.

      ('Status' > 1 AND 'Status' < 3) returns the correct data.

       

      In addition a non-core field if it's an enum will not allow direct equals check against the value. Unless you the field id.

      For instance, Category is an enumerated type.

      ('Category' = 2) fails

      ('593854943' = 2) works

      ('Category' > 1 AND 'Category' < 3) works

      Using the field id does not work on core fields. Very strange.

       

      Other non-enumerated types work. This problem seems to be specific to enumerated types.

       

      When we point our old Remedy 7 integration code using the DLLs against a Remedy 8 system. Everything appears to work.

       

      Anyone seen this? Suggestions?

        • 1. Re: Remedy 8.1 Java API query issue
          LJ LongWing

          what does 'Status' = "Value" do?

          • 2. Re: Remedy 8.1 Java API query issue

            Fails with a different error, type mismatch.

            • 3. Re: Remedy 8.1 Java API query issue
              LJ LongWing

              Ok, what method are you using to convert your string into a QualifierInfo object?

              • 4. Re: Remedy 8.1 Java API query issue

                Class: ARServerUser

                Instance method: parseQualification( queryString, queryFields1, queryField2, Constants.AR_QUALCONTEXT_DEFAULT );

                 

                The query string is ('Status' = 2) which fails. Taking out the modified

                 

                Is there some debug I could turn on to get a details description of the qualified object? Maybe there is an obvious mis-set flag? I suspect we might be using the wrong Field object. It looks like the right Field object, the field id is correct.

                 

                Here's the specific exception.

                Error processing entries from schema: Sample:Classes

                ERROR (1588): Value specified for selection not one of defined values for this field;  (2).

                        at com.bmc.arsys.qual.a.a.c.a(Unknown Source)

                        at com.bmc.arsys.qual.a.a.b.a(Unknown Source)

                        at com.bmc.arsys.qual.a.a.b.if(Unknown Source)

                        at com.bmc.arsys.qual.a.a.b.for(Unknown Source)

                        at com.bmc.arsys.qual.o.a(Unknown Source)

                        at com.bmc.arsys.api.ARServerUser.parseQualification(Unknown Source)

                        at com.bmc.arsys.api.ARServerUser.parseQualification(Unknown Source)

                • 5. Re: Remedy 8.1 Java API query issue

                  Can you post your part of code building parse Qualification line to actually firing those qualification?

                  I don't think parseQualification will throw any of such error. Other part of code must be throwing error, which will be clear when you share the part of code.

                  Do let us know which line actually throws error.

                  Is Sample:Classes Regular form ?

                  You are using 8.1 JAVA API, but to which server version you are connecting to ?

                   

                  Thanks

                  Anandsagar

                  ARSKit Studio -  The smarter and faster way to work

                  • 6. Re: Remedy 8.1 Java API query issue
                    LJ LongWing

                    Try this one instead

                     

                    parseQualification(String form, String qualification)

                              Parses a given readable qualification string into internal structure.

                    • 7. Re: Remedy 8.1 Java API query issue

                      Here's the method. I am connection using the Java API 8.1 to a Remedy ARServer 8.1 The versions are aligned up. I verified the jars after seeing your post.

                       

                      queryField = ('Status' = 2)

                      queryField1 = List of "Field" objects from the Remedy API that match with the fields in the query string.

                      queryField2 = null

                      queryContext = Always Constants.AR_QUALCONTEXT_DEFAULT

                       

                      public synchronized QualifierInfo arGetQualifier( String queryString, List<Field> queryFields1, List<Field> queryField2, int queryContext )

                              throws ARException

                          {

                              QualifierInfo qual = null;

                              ARServerUser cx = getContext();

                              if ( cx != null ) {

                                  m_log.debug( "arGetQualifier(): before ARGetQualifier()" );

                                  try {

                                      qual = cx.parseQualification( queryString, queryFields1, queryField2, queryContext );

                                  } catch ( ARException arex ) {

                                      String lc = CHARACTER_COUNT_LINE.substring( 0, Math.min( CHARACTER_COUNT_LINE.length(), queryString.length() ) );

                                      m_log.error( "Exception parsing Remedy Query:\n" + queryString + "\n" + lc +

                                                   "\nMake sure, in the xml configuration file, every Remedy field referenced in the <query> has a corresponding <field> entry." , arex );

                                      throw arex;

                                  }

                                  checkConnection();

                                  m_log.debug( "arGetQualifier(): after ARGetQualifier()" );

                              }

                              return qual;

                          }

                      • 8. Re: Remedy 8.1 Java API query issue

                        I have to admit some ignorance here. I'm not familiar with what a valid qualification string would look like. Passing null causes an exception. Link to docs that explain what a valid qualification looks like?

                        • 9. Re: Remedy 8.1 Java API query issue
                          LJ LongWing

                          your examples are valid qualifications

                          'Status' = 2

                          or

                          'Status' = "Value"

                          truly, what you put in the Advanced Search bar....

                          The method you were using is to generate a QualifierInfo object for a Set Field or Push Field action.  When doing a Query against a form, there are no 'form 1' and 'form 2', just 'form'.....so you were using the wrong method to generate the QualifierInfo for your purpose

                          • 10. Re: Remedy 8.1 Java API query issue

                            Thank you. That fixed it. I'll have to dig into the docs to understand the differences between the parseQualification calls.