Problem searching non-string values within property bundles

Platform: Windows NT 4.00.1381
Ifs version: 1.1
The documents I want to search on have an associated property bundle containing properties of type String, Integer, Date...
A. OK: When I search on a property of type String, correct documents are returned successfully.
B. OK: When I search on a property of type Integer, but specifying a String as query value, no documents are returned, as expected.
C. BAD: When I search on a property of type Integer, specifying an Integer as query value, an exception is thrown, describing that the SQL query is invalid because of a missing right parenthesis.
Here is the exception stack trace, with Verbose set to ON:
oracle.ifs.common.IfsException: IFS-22012: Search failed. Invalid query may have been specified
java.sql.SQLException: ORA-00907: missing right parenthesis
at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:740)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
at oracle.ifs.server.S_Search.open(S_Search.java:277)
at oracle.ifs.server.S_LibrarySession.DMOpenSearch(S_LibrarySession.java:4589)
at oracle.ifs.beans.LibrarySession.DMOpenSearch(LibrarySession.java)
at oracle.ifs.beans.Search.open(Search.java:472)
at oracle.ifs.beans.Search.open(Search.java:401)
at com.karat.dms.ifs.issues.query.IfsQueryTest.testQuery(IfsQueryTest.java:144)
at com.karat.dms.ifs.issues.query.IfsQueryTest.main(IfsQueryTest.java:209)
And here is the snippet of code:
public static void testQuery(LibrarySession lib) throws Exception
// Create FolderRestrictQualification
FolderPathResolver resolver = new FolderPathResolver(lib);
Folder searchFolder = (Folder)resolver.findPublicObjectByPath("/home/myfolder");
FolderRestrictQualification frq = new FolderRestrictQualification();
frq.setStartFolder(searchFolder);
// Create PropertyQualification
PropertyQualification pq = new PropertyQualification();
pq.setPropertyName("issueNumber");
pq.setValue(AttributeValue.newAttributeValue(1234));
pq.setOperatorType(AttributeQualification.EQUAL);
// Create SearchQualification
SearchQualification sq = new SearchClause(
frq, pq, SearchClause.AND);
// Create SearchClassSpecification
String cls = "DOCUMENT";
SearchClassSpecification cs = new SearchClassSpecification();
cs.addSearchClass(cls);
cs.addResultClass(cls);
// Create AttributeSearchSpecification
AttributeSearchSpecification ss = new AttributeSearchSpecification();
ss.setSearchClassSpecification(cs);
ss.setSearchQualification(sq);
// Perform search
Search search = new Search(lib, ss);
search.open();
SearchResultObject[] res = search.getItems();
if (res == null)
System.out.println("No match.");
// Display results
for (int i=0; i<res.length; i++)
LibraryObject lo = res.getLibraryObject();
long id = lo.getId().longValue();
String name = lo.getName();
System.out.println("<publicObject name='"+name+"'>");
PublicObject po = (PublicObject)lo;
// Retrieve and display property bundle
PropertyBundle pb = po.getPropertyBundle();
if (pb != null)
Property[] props = pb.getProperties();
for (int j=0; j<props.length; j++)
Property prop = props[j];
AttributeValue val = prop.getValue();
System.out.println(" <property name='"+prop.getName()+"' type='"+val.getClass().getName()+"' value='"+val.getObject(lib)+"'/>");
else
System.out.println(" <noPropertyBundle/>");
System.out.println("</publicObject>");
search.close();
Any help would be greatly appreciated...
Best Regards...

Hi Mathieu,
Looks like this is a bug. Here's why
you are getting the exception.
Search API generates SQL based on your
search constructs. It uses the LibrarySession's Localizer to get String
representations of values in the search.
In this case, after converting 1234 to
string, it ended up with 1,234 which is
confusing the SQL parser.
I will look into what we need to do this.
In the meanwhile, there is a workaround.
If you can set the NumberFormat on
LibrarySession's Localizer object to
setGroupingUsed(false) and that should make
your searches work.
Try by inserting this code prior to
running the search.
LibrarySession sess;
Localizer loc = sess.getLocalizer();
NumberFormat nf = loc.getNumberFormatter();
nf.setGroupingUsed(false);
loc.setNumberFormatter(nf);
I have not tested the side effects of doing
this on other parts of iFS. You could
do the reverse to reset the NumberFormat
right after the search, so that these
changes do not affect other aspects of
iFS.
Let me know if this helps your search run.
Thanks for finding an interesting issue.
Vijay
null

Similar Messages

  • How to search for a value within a tolerance in an array?

    I am trying to search in an array for a value of say 10 plus or minus 2. In other words, I want a value of true if there is any value in the array between 8 and 12.

    canadian;
    LabVIEW includes with a VI called In Range and Coerce. You can test the value using that VI.
    I also created a VI for exactly that. You can download it from here:
    http://www.jyestudio.com/lview.shtml
    It is called Search 1D array using conditions. Let me know if it is useful. Even more efficient, you can look at the code of that VI and then extract the functionality you want for your application.
    Regards;
    Enrique
    www.vartortech.com

  • Performing ldapsearch filtered by non-string value

    Hi all.
    I'm using OID as my central users repository.
    I know how to perform ldapsearches with filters like (cn=*) and (objectclass=*)
    In OID there is an attribute of type binary called orclobjectsid.
    When I'm trying to perform search with filter (orclobjectsid=*), I'm receiving the following error:
    Unable to search LDAP [[LDAP: error code 53 - Function Not Implemented]]
    What am I doing wrong?

    Check If attribute is indexed. If not,index an attribute using catalog.sh.

  • LAG & LEAD functions... Any Way to Retrieve the 1st non-NULL Values?

    My question is this... Has anyone found an elegant way of getting the LAG & LEAD functions to move to the 1st NON-NULL value within the partition, rather than simply using a hard-coded offset value?
    Here's some test data...
    IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
    CREATE TABLE #temp (
    BranchID INT NOT NULL,
    RandomValue INT NULL,
    TransactionDate DATETIME
    PRIMARY KEY (BranchID, TransactionDate)
    INSERT #temp (BranchID,RandomValue,TransactionDate) VALUES
    (339,6, '20060111 00:55:55'),
    (339,NULL, '20070926 23:32:00'),
    (339,NULL, '20101222 10:51:35'),
    (339,NULL, '20101222 10:51:37'),
    (339,1, '20101222 10:52:00'),
    (339,1, '20120816 12:02:00'),
    (339,1, '20121010 10:36:00'),
    (339,NULL, '20121023 10:47:53'),
    (339,NULL, '20121023 10:48:08'),
    (339,1, '20121023 10:49:00'),
    (350,1, '20060111 00:55:55'),
    (350,NULL, '20070926 23:31:06'),
    (350,NULL, '20080401 16:34:54'),
    (350,NULL, '20080528 15:06:39'),
    (350,NULL, '20100419 11:05:49'),
    (350,NULL, '20120315 08:51:00'),
    (350,NULL, '20120720 11:48:35'),
    (350,1, '20120720 14:48:00'),
    (350,NULL, '20121207 08:10:14')
    What I'm trying to accomplish... In this instance, I'm trying to populate the NULL values with the 1st non-null preceding value. 
    The LAG function works well when there's only a single null value in a sequence but doesn't do the job if there's more than a singe NULL in the sequence.
    For example ...
    SELECT
    t.BranchID,
    t.RandomValue,
    t.TransactionDate,
    COALESCE(t.RandomValue, LAG(t.RandomValue, 1) OVER (PARTITION BY t.BranchID ORDER BY t.TransactionDate)) AS LagValue
    FROM
    #temp t
    Please note that I am aware of several methods of accomplishing this particular task, including self joins, CTEs and smearing with variables.
    So, I'm not looking for alternative way of accomplishing the task... I'm wanting to know if it's possible to do this with the LAG function.
    Thanks in advance,
    Jason
    Jason Long

    I just wanted to provide a little follow-up now that I had a little time to check up and digest Itzik’s article and tested the code posed by Jingyang.
    Turns out the code posted by Jingyang didn’t actually produce the desired results but it did get me pointed in the right direction (partially my fault for crappy test data that didn’t lend itself to easy verification). That said, I did want to post the version
    of the code that does produce the correct results.
    IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
    CREATE TABLE #temp (
    BranchID INT NOT NULL,
    RandomValue INT NULL,
    TransactionDate DATETIME
    PRIMARY KEY (BranchID, TransactionDate)
    INSERT #temp (BranchID,RandomValue,TransactionDate) VALUES
    (339,6, '20060111 00:55:55'), (339,NULL, '20070926 23:32:00'), (339,NULL, '20101222 10:51:35'), (339,5, '20101222 10:51:37'),
    (339,2, '20101222 10:52:00'), (339,2, '20120816 12:02:00'), (339,2, '20121010 10:36:00'), (339,NULL, '20121023 10:47:53'),
    (339,NULL, '20121023 10:48:08'), (339,1, '20121023 10:49:00'), (350,3, '20060111 00:55:55'), (350,NULL, '20070926 23:31:06'),
    (350,NULL, '20080401 16:34:54'), (350,NULL, '20080528 15:06:39'), (350,NULL, '20100419 11:05:49'), (350,NULL, '20120315 08:51:00'),
    (350,NULL, '20120720 11:48:35'), (350,4, '20120720 14:48:00'), (350,2, '20121207 08:10:14')
    SELECT
    t.BranchID,
    t.RandomValue,
    t.TransactionDate,
    COALESCE(t.RandomValue,
    CAST(
    SUBSTRING(
    MAX(CAST(t.TransactionDate AS BINARY(4)) + CAST(t.RandomValue AS BINARY(4))) OVER (PARTITION BY t.BranchID ORDER BY t.TransactionDate ROWS UNBOUNDED PRECEDING)
    ,5,4)
    AS INT)
    ) AS RandomValueNew
    FROM
    #temp AS t
    In reality, this isn’t exactly a true answer to the original question regarding the LAG & LEAD functions, being that it uses the MAX function instead, but who cares? It still uses a windowed function to solve the problem with a single pass at the data.
    I also did a little additional testing to see if casting to BINARY(4) worked across the board with a variety of data types or if the number needed to be adjusted based the data… Here’s one of my test scripts…
    IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
    CREATE TABLE #Temp (
    ID INT,
    Num BIGINT,
    String VARCHAR(25),
    [Date] DATETIME,
    Series INT
    INSERT #temp (ID,Num,String,Date,Series) VALUES
    (1, 2, 'X', '19000101', 1), ( 2, 3, 'XX', '19000108', 1),
    (3, 4, 'XXX', '19000115', 1), ( 4, 6, 'XXXX', '19000122', 1),
    (5, 9, 'XXXXX', '19000129', 1), ( 6, 13, 'XXXXXX', '19000205', 2),
    (7, NULL, 'XXXXXXX', '19000212', 2),
    (8, NULL, 'XXXXXXXX', '19000219', 2),
    (9, NULL, 'XXXXXXXXX', '19000226', 2),
    (10, NULL, 'XXXXXXXXXX', '19000305', 2),
    (11, NULL, NULL, '19000312', 3), ( 12, 141, NULL, '19000319', 3),
    (13, 211, NULL, '19000326', 3), ( 14, 316, NULL, '19000402', 3),
    (15, 474, 'XXXXXXXXXXXXXXX', '19000409', 3),
    (16, 711, 'XXXXXXXXXXXXXXXX', '19000416', 4),
    (17, NULL, NULL, '19000423', 4), ( 18, NULL, NULL, '19000430', 4),
    (19, NULL, 'XXXXXXXXXXXXXXXXXXXX', '19000507', 4), ( 20, NULL, NULL, '19000514', 4),
    (21, 5395, NULL, '19000521', 5),
    (22, NULL, NULL, '19000528', 5),
    (23, 12138, 'XXXXXXXXXXXXXXXXXXXXXXX', '19000604', 5),
    (24, 2147483647, 'XXXXXXXXXXXXXXXXXXXXXXXX', '19000611', 5),
    (25, NULL, 'XXXXXXXXXXXXXXXXXXXXXXXXX', '19000618', 5),
    (26, 27310, 'XXXXXXXXXXXXXXXXXXXXXXXXX', '19000618', 6),
    (27, 9223372036854775807, 'XXXXXXXXXXXXXXXXXXXXXXXXX', '19000618', 6),
    (28, NULL, NULL, '19000618', 6),
    (29, NULL, 'XXXXXXXXXXXXXXXXXXXXXXXXX', '19000618', 6),
    (30, 27310, NULL, '19000618', 6)
    SELECT
    ID,
    Num,
    String,
    [Date],
    Series,
    CAST(SUBSTRING(MAX(CAST(t.[Date] AS BINARY(4)) + CAST(t.Num AS BINARY(4))) OVER (ORDER BY t.[Date] ROWS UNBOUNDED PRECEDING), 5,4) AS BIGINT) AS NumFill,
    CAST(SUBSTRING(MAX(CAST(t.[Date] AS BINARY(4)) + CAST(t.Num AS BINARY(4))) OVER (PARTITION BY t.Series ORDER BY t.[Date] ROWS UNBOUNDED PRECEDING), 5,4) AS BIGINT) AS NumFillWithPartition,
    CAST(SUBSTRING(MAX(CAST(t.[Date] AS BINARY(4)) + CAST(t.Num AS BINARY(8))) OVER (ORDER BY t.[Date] ROWS UNBOUNDED PRECEDING), 5,8) AS BIGINT) AS BigNumFill,
    CAST(SUBSTRING(MAX(CAST(t.[Date] AS BINARY(4)) + CAST(t.Num AS BINARY(8))) OVER (PARTITION BY t.Series ORDER BY t.[Date] ROWS UNBOUNDED PRECEDING), 5,8) AS BIGINT) AS BIGNumFillWithPartition,
    CAST(SUBSTRING(MAX(CAST(t.ID AS BINARY(4)) + CAST(t.String AS BINARY(255))) OVER (ORDER BY t.ID ROWS UNBOUNDED PRECEDING), 5,255) AS VARCHAR(25)) AS StringFill,
    CAST(SUBSTRING(MAX(CAST(t.ID AS BINARY(4)) + CAST(t.String AS BINARY(25))) OVER (PARTITION BY t.Series ORDER BY t.ID ROWS UNBOUNDED PRECEDING), 5,25) AS VARCHAR(25)) AS StringFillWithPartition
    FROM #Temp AS t
    Looks like BINARY(4) is just fine for any INT or DATE/DATETIME values. Bumping it up to 8 was need to capture the largest BIGINT value. For text strings, the number simply needs to be set to the column size. I tested up to 255 characters without a problem.
    It’s not included here, but I did notice that the NUMERIC data type doesn’t work at all. From what I can tell, SS doesn't like casting the binary value back to NUMERIC (I didn't test DECIMAL).
    Thanks again,
    Jason
    Jason Long

  • Help to search for a string value and return the index in the arraylist

    Hello,
    I just start java programming for the last three weeks and I cannot find a solution for this problem. I have the following List with string and integer value as shown below:
    List<Empl> list= new ArrayList<Empl>();
         list.add(new Empl(1,"Jim", "Balu",88);
         list.add(new Empl(3,"Bob", "Howards",2);
         list.add(new Empl(2,"Chris", "Hup",8);
    I have no problem of sorting this arraylist either by firstname or lastname. However, I cannot think of a way to search for a firstname or lastname and returing the whole row. I do not want to use index since I am asking user to enter the name to search. Here is my code to search for an empl based on index.
    System.out.print("Please enter index to search or (q)uit: ");
              String ans = sc.next();
              System.out.println();
              int ians = Integer(ans);
              if (ans.equalsIgnoreCase("q"))
                        choice = "n";
              else
              System.out.println("index " + list.get(ians)); //this will print out the whole row based on the index
    Since the user will never seen the contents of the arraylist, is there a way that I can search by string last/first name and will get the index location in int if the result is met?
    Please advice and thank you.
    Bob.

    user11191663 wrote:
    Since the user will never seen the contents of the arraylist, is there a way that I can search by string last/first name and will get the index location in int if the result is met?Another possibility is to set up an ArrayList for each thing you want to search on and then every time you add an employee, add the piece of data you want as well, viz:
    Empl e = new Empl(1,"Jim", "Balu",88);
    list.add(e);
    firstNames.add(e.firstName());As long as you always add them in the same order, the indexes will match, so you could do something like
    ians = firstNames.indexOf(nameToFind);to return the index of the name, if it's there (if not, it will return -1).
    I wouldn't recommend this as standard practise, but it should be OK for the level you're at.
    NOTE: indexOf() returns the index of the FIRST matching item. You may want to think about what you want to do if there are more than 1.
    Winston

  • Problem in getting last value of a string in Function Module

    Hi,
    I am working on FM in which i have to put highfen mark which is working ok,but the problem if there is when the value of string finds a space it should not insert highfen in it and i am not able to put the condition in it as it showing the higfen even when the word is full in the first line.i want to show highfen where the word is not able to display complete. here is d code which i am using right now. plzz provide me guidlines to solve this problem.
    here's d code:-
    FUNCTION Z_STRING_LENGTH1.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(I_STRING) TYPE  STRING
    *"     VALUE(LENGTH) TYPE  I
    *"  EXPORTING
    *"     VALUE(E_STRING) TYPE  STRING
    data: STRING_F type string, "Stores the value in string format
          STRING_LENGTH type i, "Length of the string
          DIFF type i,          "Difference among the value
          DIFF1 TYPE C,
          STRING1 type string,  "Stores the 1st String
          STRING2 type string,  "Stores the 2nd String
          STRING3 type string,  "Stores the 3rd String
          STRING4 type string,  "Stores the 3rd String
          STRING5 type string,  "Stores the 3rd String
          LENGTH2 type I.
    STRING_F = I_STRING.
    STRING_LENGTH = STRLEN( I_STRING ).
    DIFF = STRING_LENGTH - LENGTH.
    IF DIFF LE 0.
      DIFF = 0.
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING1 = STRING_F(LENGTH).
    ELSE.
      STRING1 = STRING_F(STRING_LENGTH).
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING2 = STRING_F+LENGTH(DIFF).
    ELSE.
      STRING2 = STRING_F+STRING_LENGTH(DIFF).
    ENDIF.
    length2 = length - 1.
    STRING3 = STRING1+length2(1).
    STRING4 = STRING2+0(1).
    IF LENGTH LE STRING_LENGTH AND STRING3 NE SPACE AND STRING4 NE SPACE.
      concatenate STRING1 '-' STRING2  into STRING5.
      e_string = STRING5.
    ELSE.
      concatenate  STRING1 STRING2 into STRING5.
      e_string = STRING5.
    ENDIF.
    ENDFUNCTION.
    Edited by: ricx .s on May 12, 2009 5:20 AM

    Hi,
    I checked your code... its working fine except for some cases it is giving dumps for which I have added certain if conditions....
    Please check the modified code below... have optimized it as well by removing one extra if condition....
    you can copy and paste the code below...
    DATA: STRING_F TYPE STRING, "Stores the value in string format
          STRING_LENGTH TYPE I, "Length of the string
          DIFF TYPE I,          "Difference among the value
          DIFF1 TYPE C,
          STRING1 TYPE STRING,  "Stores the 1st String
          STRING2 TYPE STRING,  "Stores the 2nd String
          STRING3 TYPE STRING,  "Stores the 3rd String
          STRING4 TYPE STRING,  "Stores the 3rd String
          STRING5 TYPE STRING,  "Stores the 3rd String
          LENGTH2 TYPE I.
    STRING_F = I_STRING.
    STRING_LENGTH = STRLEN( I_STRING ).
    DIFF = STRING_LENGTH - LENGTH.
    IF DIFF LE 0.
      DIFF = 0.
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING1 = STRING_F(LENGTH).
      STRING2 = STRING_F+LENGTH(DIFF). " added this statement in this if itself instead of one extra if
    " which is not required
    ELSE.
      STRING1 = STRING_F(STRING_LENGTH).
      STRING2 = STRING_F+STRING_LENGTH(DIFF).
    ENDIF.
    IF LENGTH IS NOT INITIAL.
      LENGTH2 = LENGTH - 1.
    ENDIF.
    " put this if condition as there is a dump occuring at this place.
    " Dump occurs when you give the length value as 0
    " Say for example the value of I_STRING, I passed it as SIDDARTH
    " and the length I passed as 0, then it gives me a dump
    STRING3 = STRING1+LENGTH2(1).
    IF STRING2 IS NOT INITIAL.
      STRING4 = STRING2+0(1).
    ENDIF.
    " put this if condition as there is a dump occuring at this place.
    " Dump occurs when you give the length value greater than or equal to
    " the string length
    " Say for example the value of I_STRING, I passed it as SIDDARTH
    " and the length I passed as 8, then it gives me a dump
    IF LENGTH LE STRING_LENGTH AND STRING3 NE SPACE AND STRING4 NE SPACE.
      CONCATENATE STRING1 '-' STRING2  INTO STRING5.
      E_STRING = STRING5.
    ELSE.
      CONCATENATE  STRING1 STRING2 INTO STRING5.
      E_STRING = STRING5.
    ENDIF.

  • How to solve sync problem between Outlook calendar and iPhone when reminder is set to _some_ non-standard values?

    Hi,
    I am having a sync problem between my iPhone/iPad and Outlook calendar events (Outlook 2010).
    Here is the description of the problem:
    1. In Outlook - please create a new event/appointment (e.g. "Test").
    2. Reminder is set by default to 15 minutes. You can change it by using a dropdown menu - please select: "0,5 days".
    3. Click on "0,5 days" and change it manually to "14,5 days".
    4. Click on "Save & Close".
    5. (Do not snooze or dismiss the reminder.)
    6. Sync with your iPhone/iPad.
    7. Open this new event on iPhone/iPad - you can see that alert is set to "15 minutes before" instead to a correct value that was set in Outlook.
    The same problem can be seen if you set the reminder to e.g. "3 weeks" (standard value is "2 weeks").
    However, it is interesting that non-standard values like "1,5 days" (and all other until "13,5 days") are synced without any problem.
    Does anyone have a solution how to solve this problem (different than the trivial solution of not using those strange values)?
    Thanks!

    Thanks to another post (https://discussions.apple.com/message/17501071#17501071) I reset the sync history, here is what to do: 
    Launch iTunes.
    Before you hook up your iPhone to the PC and iTunes do this: Go to iTunes Edit menu > Preferences… > select the iPhone > click the Reset Synch History button > click OK.
    Connect the iPhone to the PC and let iTunes recognize it.
    In the top right corner is the iPhone icon, click on the left side of the iPhone icon > the iPhone menu launches.
    In the menu along the top click on Info > make your selections > click Sync button > it gives you a dialog at the top with the steps it’s going through during the sync.
    In the top left of the iTunes app > click Exit.

  • Searching for a substring within a string

    can someone reccomend a simple way to search for a substring within a string and count the number occurences of that substring.
    The substring and the string will be provided as command line parameters.
    Thanks
    gg

    A simple way would be to use the indexOf methods in String:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
    Not sure what this has to do with event handling though :-P

  • How to find first non zero value from the numeric value or string?

    Hiii, Every body
              I have one numeric indicator in which some valuse is coming with the decimal value, lets say 0.00013, now i want to find the first non-zero value from this numeric indicator, then what should i do to do so? i have converted it in the string, but i could not find any method to find first non-zero value from that string or either from the numeric indicator????
          Can you please help me, how to do it? i have attached the vi and write all the description inside.
    Thanks in Advance,
    Nisahnt
    Attachments:
    Find first nonzero.vi ‏20 KB

    Just convert it to an exponential string and take the first character .
    Message Edited by altenbach on 05-10-2006 08:00 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FisrstNonzeroChar.png ‏3 KB
    FindFirstNonzeroCharacter.vi ‏20 KB

  • Problem to get max string value

    Hi
    my problem is i don't get correct result when i get max string value from my table. for example, it returns '9' as max value while i have some bigger string values like 73, 80,65, ...
    i found
    some solutions to handle this problem (like converting to char or adding some zero in the begining of my value) but it does not appropriate for my situation because my string value maybe everything (some of my customers can use numbers while some other
    else can use alphabetical+numbers)!.
    can anybody help me ?
    thanks in advance
    http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx

    When I see NVARCHAR(50)(50) I am pretty sure the data was declared by an ACCESS programmer who has no idea what he is doing. Do you really have first
    and last names that need fifty UNICODE characters ?  You will get them!  If you invite garbage data, it will come. The USPS uses VARCHAR(20) for names; this has to do with the size of mailing labels and the fact
    that Latin-1 is required by ISO in ALL languages. 
    lease read the  "Stairway to Data" series and pay attention to last sections on the design of encoding schemes. What you have is useless and dangerous because it has no data integrity.  Tag
    numbers (learn what that means, please) need a regular expression and I like to have a check digit. My first guess, without an specs is that you need something like this:  
    patient _case_nbr CHAR() NOT NULL PRIMARY KEY
     CHECK (patient _case_nbr 
      LIKE '[ ABC][0-9][0-9][0-9][0-9][0-9]')
    Fixed length for the forms and display, characters limtied to the Latin-1 Unicode set, and easy to sort. 
     http://www.sqlservercentral.com/articles/Database+Design/72612/)
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Problem with prepared statement where cluase when passing string value.Help

    I am updating a table using the following code. I am using string parameter in where clause. if I use Long parameter in where clause with ps.setLong , this code is working. Is there any special way to pass string value? Am I doing anything wrong?
    ===================
    updateMPSQL.append("UPDATE MP_Table SET ");
         updateMPSQL.append("MPRqmt = ?,End_Dt = ? ");
              updateMPSQL.append("where POS = ? ");
              System.out.println(updateMPSQL.toString());
              con     = getConnection(false) ;
              ps      = con.prepareStatement(updateMPSQL.toString());
              ps.setLong(1,MPB.getMPRqmt());
              ps.setDate(2,MPB.getEnd_Dt());
              ps.setString(3,MPB.getPos());
    result = ps.execute();
              System.out.println("Result : " + result);
    ==========
    Please help me.
    Thanks in advance.
    Regards,
    Sekhar

    doesn't Pos look like a number rather than a string variable?
    if I use Long
    parameter in where clause with ps.setLong , this code
    is working.
    updateMPSQL.append("where POS = ? ");
    ps.setString(3,MPB.getPos());

  • Generic problem for search help without values

    Hi,
    Always I open a search help without values I get the warning popup "No values found" but after this no link let me come back to the previous screen.
    Does anybody know how I can solve this (in a standard way)
    thanks
    regards

    Hi
    It seems to be a bug in the system.
    <b>Please have a look at the following SAP OSS Notes -></b>
    <u>Note 574604 - Various correction reports for EBP business partner
    Note 1028643 - Input help for contact persons in purchase order
    Note 843008 - EBP4.0 and higher: Terms of Payment, Texts and codes
    526416 Structural enhancements LFA1
    698246 EBP 4.0 address maintenance: Default address for address use
    701321 EBP 3.5 address maintenance: Default address for address use
    701323 EBP 3.0 address maintenance: Default address for address use
    701384 BBP 2.0C address maintenance:Default address for address use
    690619 Plants are not transferred during location replication
    641960 New processing of terms of payment in EBP 3.5
    628386 Incorrect link for EBP for 'External business partners'
    Note 544392 Error in search helps EBP 2.0
    Note 544816 Error in search helps EBP 3.5
    Note 544713 Error in search helps EBP 3.0</u>
    Please raise a customer OSS message with SAP as well.
    Regards
    - Atul

  • Problems converting string value to database timestamp

    I have values coming from a flat file in the form YYYYMM. I need to convert this value to a database timestamp. The reason for this is, furhter down in the flow, I need to bump this value up against a database table column in the form of YYYYMMDD HH:MM:SS.
    The first thing I do is tack on a day to the value so I have a string value in the form of YYYYMMDD. Once this is done, I then try to pass the value to a data conversion transformation. A sample value looks like this:
    20140801
    When I try to conver the string to DT_DBTIMESTAMP, I get:
    "The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
    I don't get it. The string is length 50. What am I missing?

    Had to break apart the source.
    SUBSTRING([Paid Period],1,4) + "-" + SUBSTRING([Paid Period],5,2) + "-01 " + "00:00:00.000"

  • How to pass dynamically generated string value as array name in TestStand?

    Hi All,
              I have a string variable which holds an array name as its value. The string value is a dynamically generated one. Now my problem is how to retrieve the values within the array where as the array name is stored in a string variable.
    for eg:
    fileglobals.InfoName = "Array_Name" --> fileglobals.InfoName is a string variable, Array_Name is the array name generated dynamically and it is known only at run-time.
    Array_Name[0] = "a";
    Array_Name[1] = "b";
    Array_Name[2] = "c";
    In the above case, I have to retrieve the values of a, b and c
    Any help is greatly appreciated
    Thanks
    Arun Prasath E G

    Hi,
    Looking at your sequencefile.
    You seem to be trying to save into FlieGlobals.InfoName a string with the values of "FileGlobals.Info_0".."FileGlobals.Info_n" where n is the value of Parameter.TestSocket.Index.
    Then you are setting the value into FileGlobals.TempName from "StationGlobals.FileGlobals.Info_0" assuming Parameter.TestSocket.Index is 0.
    Is this correct?
    I realise this is a cutdown sequence file but you must make sure These variable actually exist in either FileGlobals or StationGlobals. Also with FileGlobals each SequenceFile has its own FileGlobals unless you have set the properties of the SequencFile to use a common FileGlobals.
    What was the precise error you was seeing as it will properly telling you what variable of property it can't find.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • String value changes single quote ' to double quote "

    I am creating a list with different bill codes within single
    quotes as follows
    <cfset corlist = " '1100 ','1200 ','1300 ','1700 ','1800
    ','1950 ','7001 ' ">
    when I do an output
    for
    <cfoutput>AND idbillcode IN ( #corlist
    #)</cfoutput>
    I get the values as follows
    AND idbillcode IN ( '1100 ','1200 ','1300 ','1700 ','1800
    ','1950 ','7001 ')
    However when I put the same string within a cfquery the
    single quotes get replaced by double quotes as follows
    AND idbillcode IN ( ''1100 '',''1200 '',''1300 '',''1700
    '',''1800 '',''1950 '',''7001 '') which throws an error.
    Anybody has any clues.
    Thanks.

    However when I put the same string within a cfquery the
    single quotes
    get replaced by double quotes as follows
    AND idbillcode IN ( ''1100 '',''1200 '',''1300 '',''1700
    '',''1800
    '',''1950
    '',''7001 '') which throws an error.
    Anybody has any clues.
    That is ColdFusion escaping the single quotes, by doubling
    them so that
    you can search for strings such as "singhpk's code does not
    work".
    (Note the single quote/apostrophe that would normally break
    this string
    if it was not escaped.
    To tell CF not to do this, one uses the
    preserveSingleQuotes() function.
    The documentation has all the details.

Maybe you are looking for

  • How to actual material data in sales order

    Hi, i create an sales order (VA01) with 1 Material (say 300400). Now i can see, that some data (Gross Weight and Net Weight) are not correct (empty). Now i go in an new modus to MM02, change this fields and save this material. Now i go back to the mo

  • The formatting of text goes wrong in my mac mail when it leaves me?

    When I write an email in Mac Mail (sending from a me.com email address), I am able to format the font of the email perfectly well at my end, choosing whatever font etc I want & the settings look fine to select a particular font but then by the time t

  • ECC 6.0 Source Systems are added to 2 Different Folders - BI and SAP

    Hi Experts:                 Our BASIS team added 2 ECC 6.0 Source Systems to BI 7.0. One of the ECC 6.0 System is added under BI Folder ( where DataMart Source stays) and other ECC 6.0 system is added under SAP folder where all other R/3 Source Syste

  • Sending Photos From My iPhone

    How do I send a photo from my iPhone as a text message to another phone? I see that I can only send it as an E-mail.

  • How to Clear the Console in java

    Hello i am new to java. in one of my assignment i have to clear the screen i have tried the following approaches which are not working , one more thing i am using win xp[ with service pack 2 i have tried following 1 passing th eansii escape sequence