Get a strings length with FontMetrics

Hi,
I am using the following code to get the width of a string with FontMetrics. The problem is that the ToolKit .getFontMetrics has been deprecated. My class is a going to be used by a xslt stylesheet, so I do not have Components. How do I obtain the width of a string without a component?
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Toolkit;
public class StringLength {
     public static void main(String[] args) throws NumberFormatException {
          if(args.length < 2){
               System.out.println("StringLength <string> <int font size>");
               System.exit(0);
          }else{
               getStringLength(args[0], Integer.parseInt(args[1]));                                   
     @SuppressWarnings("deprecation")
     public static int getStringLength(String str, int size){
          Toolkit toolkit =  Toolkit.getDefaultToolkit();
          int stringlen = 0;                    
          Font font = new Font("Arial", Font.PLAIN, 9);          
          FontMetrics fontMetrics = toolkit.getFontMetrics(font); //Depreciated
          System.out.println ("[Stylesheet Info] Calculating width for: " + str + ": "  + fontMetrics.stringWidth(str));
          stringlen = fontMetrics.stringWidth(str);     
          return stringlen;
}

Thanks - when all else fails, read the directions :)
Solution:
Font font = new Font("Arial", Font.PLAIN, 9);
FontRenderContext frc = new FontRenderContext(null, false, false);          
int stringWidth = (int)font.getStringBounds(str, frc).getWidth();
System.out.println ("[Stylesheet Info] Calculating width for: " + str + ": "  + stringWidth);          
return stringWidth;

Similar Messages

  • Impossible to get a String field with GetFieldID !!!!!!

    Hi, I write here my classes and explain my problem :
    ------------------------- Class Lexicon.java ---------------------------
    package SlpTkJava.JavaCode;
    public class Lexicon {
    public native void next(SearchReturn search);
    static {
    System.loadLibrary("slptkjava");
    --------------------------- Class SearchReturn.java --------------------
    package SlpTkJava.JavaCode;
    public class SearchReturn {
    public LexItem access;
    -------------------------- Class LexItem.java --------------------------
    package SlpTkJava.JavaCode;
    public class LexItem {
    public int lemma;
    public String graphy;
    --------------------------- File Lexicon.c -----------------------------
    * Class: SlpTkJava_JavaCode_Lexicon
    * Method: next
    * Signature: (LSlpTkJava/JavaCode/SearchReturn;)V
    JNIEXPORT void JNICALL Java_SlpTkJava_JavaCode_Lexicon_next(JNIEnv *env,
                                       jobject obj,
                                       jobject search){
    jfieldID accessFID, graphyFID, lemmaFID;
    jclass searchReturnCls, lexItemCls;
    jobject access;
    searchReturnCls = (*env)->FindClass(env, "SlpTkJava/JavaCode/SearchReturn");
    if ((*env)->ExceptionOccurred(env)){
    (*env)->ExceptionDescribe(env);
    (*env)->ExceptionClear(env);
    accessFID = (*env)->GetFieldID(env, searchReturnCls, "access", "LSlpTkJava/JavaCode/LexItem;");
    if ((*env)->ExceptionOccurred(env)){
    (*env)->ExceptionDescribe(env);
    (*env)->ExceptionClear(env);
    access = (*env)->GetObjectField(env, search, accessFID);
    if ((*env)->ExceptionOccurred(env)){
    (*env)->ExceptionDescribe(env);
    (*env)->ExceptionClear(env);
    lexItemCls = (*env)->FindClass(env, "SlpTkJava/JavaCode/LexItem");
    if ((*env)->ExceptionOccurred(env)){
    (*env)->ExceptionDescribe(env);
    (*env)->ExceptionClear(env);
    lemmaFID = (*env)->GetFieldID(env, lexItemCls, "lemma", "I");
    if ((*env)->ExceptionOccurred(env)){
    (*env)->ExceptionDescribe(env);
    (*env)->ExceptionClear(env);
    graphyFID = (*env)->GetFieldID(env, lexItemCls, "graphy", "LJava/lang/String;");
    if ((*env)->ExceptionOccurred(env)){
    (*env)->ExceptionDescribe(env);
    (*env)->ExceptionClear(env);
    When I run this function in a testFile, I get this exception :
    Exception in thread "main" java.lang.NoSuchFieldError: graphy
    at SlpTkJava.JavaCode.Lexicon.next(Native Method)
    at TestLexicon.main(TestLexicon.java:58)
    I can't understand because the system can load the int field from the "access" object and not the String field !
    I can precise that I'm on Solaris.
    Please help me it's urgent !
    Thank you.
    Zigune

    I think your problem is:
    graphyFID = (*env)->GetFieldID(env, lexItemCls, "graphy", "LJava/lang/String;");
    should be
    graphyFID = (*env)->GetFieldID(env, lexItemCls, "graphy", "Ljava/lang/String;");
    i.e. java/lang/String - java is lower case.

  • Invalid string length!    message ODBC Trace Windows Vista Oracle 10gR2

    Hi there
    I have an issue with Oracle 10gR2 installed at Windows Vista Enterprise SP1.
    For troubleshooting purposes for a 3rd partu applications, I need to get ODBC traces.
    the thing is that the SQL statements doesnt appear at all:
    iDocCli be4-131c EXIT SQLExecDirect with return code 0 (SQL_SUCCESS)
    HSTMT 0217E470
    UCHAR * 0x00E5A750 [      -3] <Invalid string length!>
    SDWORD -3
    I am getting <Invalid string length!> error message instead of "select ...."
    Same client installed at xp box, but trace is free of those error messages.
    oracle.client","10.2.0.3.0"
    Any help will be appreciated
    RGDS

    It is certified.
    It is a content management software: invesdoc.
    I installed
    Oracle Database 10g Release 2 (10.2.0.3/10.2.0.4) for Microsoft Windows Vista and Windows 2008

  • How to programati​cally get enum strings in RT code?

    Hi all,
    In desktop programs, I can programatically get a list of enum strings by creating a (possibly-hidden) FP control, linking it to a property node, and reading from the Strings[] property.
    Unfortunately, property nodes aren't supported on RT targets. What other options are there?
    Thanks in advance!

    I'm assuming you have one value of an Enum (from, say, a Control, or possibly from an "Enum constant" that you have available) and want to create an array of strings holding all possible values of the Enum.  There are two really nice features that LabVIEW has to allow you to easily accomplish this goal.
    First, the Format into String function will accept an Enum and will return a String representing it's "value", i.e. if you create an Enum for a State Machine with values "Initialize", "Acquire", "Process", and "Exit" (corresponding to numbers 0, 1, 2, 3), then putting the Initialize Enum into Format into String returns the string "Initialize".
    The other nice feature is that the Increment function (on the Numerics page) "wraps around" on Enums, so that incrementing "Exit" (in the previous example) gives you "Initialiize"
    So consider the following:  Create a For Loop with a Shift Register and a tunnel beneath it.  Wire "Initialize" into both the Shift Register and the Tunnel.  Inside the For Loop, take the value on the Shift Register, get its String representation with Format into String (and bring it out through an Indexing tunnel), increment it and connect the incremented value to the output Shift Register.  Wire this incremented value, along with the input tunnel holding the initial value, into an "Is Equal?" comparator that you wire to the While's Stop control.
    This will neatly step through every value of the enum exactly once (as it exits when the "wrap-around" occurs), giving you an array corresponding to the values of the Enum.  If you start the process with the first Enum value (using a Constant, for example), the String Array will exactly correspond to your Enum (that is, the first element will be the name of the first Enum value), but even if you put an arbitrary member of the Enum as the input, you will still get an array of all of the Enum values.
    Bob Schor

  • Getting all VARCHAR fields with string length different then x

    Hello,
    I am trying to get from a table all the rows which contain in a certain varchar field a string length different than x (5 i.e.):
    varchar field
    treds
    fd <-
    grgrt
    sdfsdfsdf <-
    fdsds
    the marked rows will been given out.
    Thanks!

    Term, the Oracle SQL manual contains documentation on the Oracle functions. Most of the functions can be classified as either character functions, number (math) functions, date functions, and conversion functions.
    If you are going to work with Oracle you will benefit from looking on the list of available functions to become familiar with what is available.
    HTH -- Mark D Powell --

  • How to get the string's byte length?

    I have some string,I want to get the string's byte length,how
    can do it?
    for example:
    <cfoutput>#len('hihi,这是测试')#</cfoutput>
    output is 9
    I want to get the byte length is 14, how can i get it?
    Thanks.

    >> Fair cop. I didn't realise that asc() returned the
    codepoint rather than the
    > actual character code.
    >
    > and what would be the difference?
    Oh, sorry, whatever the term is (I'm crap with jargon). The
    value returned
    by asc() for those chars was only two bytes (ie: four hex
    digits). I
    didn't realise there was more to it than that, and that
    2-byte value maps
    to some other THREE byte value. I need to do some reading...
    > that's what both cf & java counted as the length.
    CHARACTER length, sure. No-one's disputing that. On the other
    hand,
    no-one's asking about it, either.
    > by adding a BOM you've already effected the encoding,
    which may or may not
    > match the original. so you still don't know how many
    bytes were in the original
    > string.
    [groan]
    Yes, that's a reasonable strawman there. I was only putting
    it in a file
    so I could save it and check the number of bytes occupied by
    the data.
    Clearly... CLEARLY... the OP is not asking for a character
    length of that
    string. They've said as much.
    I copy and pasted the string from their post, and used it as
    a
    demonstration of how "nine" is not the right answer for the
    BYTE LENGTH of
    that string. Whether or not the original string was UTF-8,
    UTF-16 or
    special-marmoset-encoding, it almost certainly was NOT in a
    fictitious kind
    encoding in which each of those particular characters only
    occupied one
    byte each, which would mean that "nine" is the correct answer
    to the
    question.
    When I copied those characters from either the web browser
    for from my
    text-based news agent, notepad identified them (and rendered
    them
    correctly) as UTF-8, so I'm fairly confident they ARE UTF-8.
    Of course
    this could be down to some intermediary encoding (pasting
    them in to the
    original posting, for example, via some encoding-transforming
    mechanism),
    but Occam's Razor suggests the original question was from a
    UTF-8 POV.
    But maybe we should quit speculating and ask the OP. Unless
    they've
    buggered off in despair of how drawn out all this is getting.
    For which I
    would not blame them.
    Adam

  • Approval task SP09: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'

    Hi everyone,
    I just installed SP09 and i was testing the solution. And I found a problem with the approvals tasks.
    I configured a simple ROLE approval task for validate add event. And when the runtime executes the task, the dispatcher log shows a error:
    ERROR: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'
    And the notifications configured on approval task does not start either.
    The approval goes to the ToDO tab of the approver, but when approved, also the ROLE stays in "Pending" State.
    I downgraded the Runtime components to SP08 to test, and the approvals tasks works correctly.
    Has anyone passed trough this situation in SP09?
    I think there is an issue with the runtime components delivered with this initial package of SP09.
    Suggestions?

    Hi Kelvin,2016081
    The issue is caused by a program error in the Dispatcher component. A fix will be provided in Identity Management SP9 Patch 2 for the Runtime component. I expect the patch will be delivered within a week or two.
    For more info about the issue and the patch please refer to SAPNote 2016081.
    @Michael Penn - I might be able to assist if you provide the ticket number
    Cheers,
    Kristiyan
    IdM Development

  • Regular Expressions with Unicode Strings - length restriction?

    Hi,
    I can't quite figure this one out. I am checking a String for the presence of a URL.. more specifically, a jpg or gif URL.
    Anyway, the following reg exp will work fine for me. However, when testing with unicode data (chinese text) the expression will only work up to a certain string length. Here's an example:
    boolean isURL = text.matches(".*http\\S*(jpg|gif).*");
    My thought is that since Unicode data takes up more space, there a limitation to dealing with Strings. Does anyone know what that number is? Or, is there another reason the reg exp fails??
    thanks,
    joe
    Example::
    This works for any length String I throw at it using standard ASCII text.. But a unicode string of a certain length won't recognize the URL (I doubt I can simply paste my example here and have it turn out correctly..)
    DOESN'T WORK: (length is reported via text.length() as 344
    "FWD: test_tancy: FWD: tancy: FWD: supporter:
    &#27973;&#28129;&#33394;&#24425;&#36896;&#28165;&#20937;
    &#35201;&#35753;&#23621;&#25152;&#30475;&#36215;&#26469;&#28165;&#29245;&#20937;&#24555;&#65292;&#21487;&#37319;&#29992;&#20197;&#30333;&#33394;&#20026;&#20027;&#35843;&#30340;&#24067;&#32622;&#12290;&#30333;&#33394;&#19981;&#20294;&#33021;&#22686;&#21152;&#31354;&#38388;&#24863;&#65292;&#36824;&#33021;&#33829;&#36896;&#26126;&#24555;&#23425;&#38745;&#30340;&#27668;&#27675;&#65292;&#35753;&#20154;&#24773;&#32490;&#31283;&#23450;&#12290;&#21478;&#22806;&#65292;&#26377;&#24847;&#35782;&#22320;&#22686;&#28155;&#19968;&#28857;&#20919;&#33394;&#65292;&#20063;&#33021;&#20196;&#20154;&#22312;&#35270;&#35273;&#19978;&#35273;&#24471;&#30021;&#24555;&#12290;&#19981;&#36807;&#65292;&#19968;&#38388;&#25151;&#20869;&#33509;&#20840;&#37096;&#20351;&#29992;&#20919;&#33394;&#65292;&#25110;&#20840;&#37096;&#37319;&#29992;&#26262;&#33394;&#65292;&#20250;&#20351;&#20154;&#24863;&#21040;&#19981;&#23433;&#12290;&#26368;&#22909;&#26159;&#30830;&#23450;&#20027;&#33394;&#21518;&#65292;&#23567;&#38754;&#31215;&#20351;&#29992;&#20123;&#21576;&#40092;&#26126;&#23545;&#27604;&#30340;&#33394;&#24425;&#12290;&#20837;&#22799;&#36141;&#32622;&#19968;&#20123;&#33394;&#35843;&#28165;&#20937;&#30340;&#39280;&#29289;&#25670;&#35774;&#65292;&#26159;&#26368;&#30465;&#38065;&#26377;&#25928;&#30340;&#19968;&#25307;&#65292;&#22914;&#20026;&#21488;&#28783;&#25442;&#20010;&#30333;&#33394;&#28783;&#32617;&#12289;&#22312;&#27927;&#25163;&#38388;&#25918;&#19968;&#22871;&#20912;&#34013;&#33394;&#30340;&#27792;&#28020;&#29992;&#20855;&#31561;&#12290;(UU&#20026;&#24744;&#25552;&#20379;&#29983;&#27963;&#21672;&#35759;&#24182;&#31069;&#24744;&#29983;&#27963;&#24841;&#24555;&#65281;&#22914;&#19981;&#24076;&#26395;&#25171;&#25200;&#35831;&#22238;&#22797;?NO?)http://www.blah.com/servlet/mailbox?item=fc-10Tq9aljw0w9.jpg"
    WORKS: (length is reported via text.length() as 296
    "FWD: Joe: &#35201;&#35753;&#23621;&#25152;&#30475;&#36215;&#26469;&#28165;&#29245;&#20937;&#24555;&#65292;&#21487;&#37319;&#29992;&#20197;&#30333;&#33394;&#20026;&#20027;&#35843;&#30340;&#24067;&#32622;&#12290;&#30333;&#33394;&#19981;&#20294;&#33021;&#22686;&#21152;&#31354;&#38388;&#24863;&#65292;&#36824;&#33021;&#33829;&#36896;&#26126;&#24555;&#23425;&#38745;&#30340;&#27668;&#27675;&#65292;&#35753;&#20154;&#24773;&#32490;&#31283;&#23450;&#12290;&#21478;&#22806;&#65292;&#26377;&#24847;&#35782;&#22320;&#22686;&#28155;&#19968;&#28857;&#20919;&#33394;&#65292;&#20063;&#33021;&#20196;&#20154;&#22312;&#35270;&#35273;&#19978;&#35273;&#24471;&#30021;&#24555;&#12290;&#19981;&#36807;&#65292;&#19968;&#38388;&#25151;&#20869;&#33509;&#20840;&#37096;&#20351;&#29992;&#20919;&#33394;&#65292;&#25110;&#20840;&#37096;&#37319;&#29992;&#26262;&#33394;&#65292;&#20250;&#20351;&#20154;&#24863;&#21040;&#19981;&#23433;&#12290;&#26368;&#22909;&#26159;&#30830;&#23450;&#20027;&#33394;&#21518;&#65292;&#23567;&#38754;&#31215;&#20351;&#29992;&#20123;&#21576;&#40092;&#26126;&#23545;&#27604;&#30340;&#33394;&#24425;&#12290;&#20837;&#22799;&#36141;&#32622;&#19968;&#20123;&#33394;&#35843;&#28165;&#20937;&#30340;&#39280;&#29289;&#25670;&#35774;&#65292;&#26159;&#26368;&#30465;&#38065;&#26377;&#25928;&#30340;&#19968;&#25307;&#65292;&#22914;&#20026;&#21488;&#28783;&#25442;&#20010;&#30333;&#33394;&#28783;&#32617;&#12289;&#22312;&#27927;&#25163;&#38388;&#25918;&#19968;&#22871;&#20912;&#34013;&#33394;&#30340;&#27792;&#28020;&#29992;&#20855;&#31561;&#12290;(UU&#20026;&#24744;&#25552;&#20379;&#29983;&#27963;&#21672;&#35759;&#24182;&#31069;&#24744;&#29983;&#27963;&#24841;&#24555;&#65281;&#22914;&#19981;&#24076;&#26395;&#25171;&#25200;&#35831;&#22238;&#22797;?NO?)http://www.blah.com/servlet/mailbox?item=fc-10Tq9aljw0w9.jpg"

    Perhaps you should check the version of Java you are using. I am using 1.4.2_04
    public class A {
        public static void main(String[] args) throws UnsupportedEncodingException {
            String text = "FWD: test_tancy: FWD: tancy: FWD: supporter:                   " +
                    new String(new char[]{(char) 35201, (char) 35753, (char) 23621, (char) 25152, (char) 30475, (char) 36215,
                                          (char) 26469, (char) 28165, (char) 29245, (char) 20937, (char) 24555, (char) 65292,
                                          (char) 21487, (char) 37319, (char) 29992, (char) 20197, (char) 30333, (char) 33394,
                                          (char) 20026, (char) 20027, (char) 35843, (char) 30340, (char) 24067, (char) 32622,
                                          (char) 12290, (char) 30333, (char) 33394, (char) 19981, (char) 20294, (char) 33021,
                                          (char) 22686, (char) 21152, (char) 31354, (char) 38388, (char) 24863, (char) 65292,
                                          (char) 36824, (char) 33021, (char) 33829, (char) 36896, (char) 26126, (char) 24555,
                                          (char) 23425, (char) 38745, (char) 30340, (char) 27668, (char) 27675, (char) 65292,
                                          (char) 35753, (char) 20154, (char) 24773, (char) 32490, (char) 31283, (char) 23450,
                                          (char) 12290, (char) 21478, (char) 22806, (char) 65292, (char) 26377, (char) 24847,
                                          (char) 35782, (char) 22320, (char) 22686, (char) 28155, (char) 19968, (char) 28857,
                                          (char) 20919, (char) 33394, (char) 65292, (char) 20063, (char) 33021, (char) 20196,
                                          (char) 20154, (char) 22312, (char) 35270, (char) 35273, (char) 19978, (char) 35273,
                                          (char) 24471, (char) 30021, (char) 24555, (char) 12290, (char) 19981, (char) 36807,
                                          (char) 65292, (char) 19968, (char) 38388, (char) 25151, (char) 20869, (char) 33509,
                                          (char) 20840, (char) 37096, (char) 20351, (char) 29992, (char) 20919, (char) 33394,
                                          (char) 65292, (char) 25110, (char) 20840, (char) 37096, (char) 37319, (char) 29992,
                                          (char) 26262, (char) 33394, (char) 65292, (char) 20250, (char) 20351, (char) 20154,
                                          (char) 24863, (char) 21040, (char) 19981, (char) 23433, (char) 12290, (char) 26368,
                                          (char) 22909, (char) 26159, (char) 30830, (char) 23450, (char) 20027, (char) 33394,
                                          (char) 21518, (char) 65292, (char) 23567, (char) 38754, (char) 31215, (char) 20351,
                                          (char) 29992, (char) 20123, (char) 21576, (char) 40092, (char) 26126, (char) 23545,
                                          (char) 27604, (char) 30340, (char) 33394, (char) 24425, (char) 12290, (char) 20837,
                                          (char) 22799, (char) 36141, (char) 32622, (char) 19968, (char) 20123, (char) 33394,
                                          (char) 35843, (char) 28165, (char) 20937, (char) 30340, (char) 39280, (char) 29289,
                                          (char) 25670, (char) 35774, (char) 65292, (char) 26159, (char) 26368, (char) 30465,
                                          (char) 38065, (char) 26377, (char) 25928, (char) 30340, (char) 19968, (char) 25307,
                                          (char) 65292, (char) 22914, (char) 20026, (char) 21488, (char) 28783, (char) 25442,
                                          (char) 20010, (char) 30333, (char) 33394, (char) 28783, (char) 32617, (char) 12289,
                                          (char) 22312, (char) 27927, (char) 25163, (char) 38388, (char) 25918, (char) 19968,
                                          (char) 22871, (char) 20912, (char) 34013, (char) 33394, (char) 30340, (char) 27792,
                                          (char) 28020, (char) 29992, (char) 20855, (char) 31561, (char) 12290, (char) 20026,
                                          (char) 24744, (char) 25552, (char) 20379, (char) 29983, (char) 27963, (char) 21672,
                                          (char) 35759, (char) 24182, (char) 31069, (char) 24744, (char) 29983, (char) 27963,
                                          (char) 24841, (char) 24555, (char) 65281, (char) 22914, (char) 19981, (char) 24076,
                                          (char) 26395, (char) 25171, (char) 25200, (char) 35831, (char) 22238, (char) 22797}) +
                    "?NO?)http://www.blah.com/servlet/mailbox?item=fc-10Tq9aljw0w9.jpg";
            boolean isURL = text.matches(".*http\\S*(jpg|gif).*");
            System.out.println("isURL="+isURL+", length="+text.length());
    }Prints
    isURL=true, length=344

  • While trying to invoke the method java.lang.String.length() of an object loaded from local variable 'payload'

    Hi,
    Our PI is getting data from WebSphere MQ and pushing to SAP. So our sender CC is JMS and receiver is Proxy. Our PI version is 7.31.
    Our connectivity between the MQ is success but getting the following error while trying to read the payload.
    Text: TxManagerFilter received an error:
    [EXCEPTION]
    java.lang.NullPointerException: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'payload'
           at com.sap.aii.adapter.jms.core.channel.filter.ConvertJmsMessageToBinaryFilter.filter(ConvertJmsMessageToBinaryFilter.java:73)
           at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:204)
           at com.sap.aii.adapter.jms.core.channel.filter.InboundDuplicateCheckFilter.filter(InboundDuplicateCheckFilter.java:348)
           at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:204)
    I have searched SDN but couldn't fix it. Please provide your suggestion.
    With Regards
    Amarnath M

    Hi Amarnath,
    Where exactly you are getting this error?
    If you are getting at JMS Sender communication channel, try to stop and start the JMS communication channel and see the status, also use XPI Inspector to get the exact error log.
    for reference follow below blogs:
    Michal's PI tips: ActiveMQ - JMS - topics with SAP PI 7.3
    Michal's PI tips: XPI inspector - help OSS and yourself
    XPI Inspector

  • C++ CFX - return string type with a lot of '\0'

    Hello
    Header of the function for setting data in query is:
    void CCFXQuery::SetData(int iRow, int iColumn, LPCSTR
    lpszData).
    How to set field of query, or some other return value with
    the "string" type which may conatain string with a lot of '\0'
    signs? SetData function somehow has to know (LPCSTR argument type
    which is pointer), where string is ending, so that's why it's
    getting only string '\0' terminated. If I pass value, function gets
    only that part to the first appearance of that sign. How to return
    to the user all data, or in which function it can be self defined
    (length of returned value)?
    Thanks

    Hi Mercedes
    Change the Isolation property of the iview to url and try to give height as fixed.
    You can adjust the height of iview by adjustHeight method.
    adjustHeight(document.getElementById(<id of ur iview>),<heightyouneeded>).May be this function has to be invoked from separate iview.
    Use this link for reference.
    Automatic Height of iView/Page & Footer in Framework page
    Regards
    Geogi
    Message was edited by: Geogi Luke

  • ORA-30352: inconsistent numeric precision or string length

    Trying to create a materialized view and am getting this error.
    ORA-30352: inconsistent numeric precision or string length
    How do I fix this?

    Mix and matching of types with my facts and dimensions. Making them the same resolved this.
    Edited by: user7853353 on Jun 18, 2012 5:33 PM

  • Getting the max length

    i am using pl/sql and i need to do some validation regarding the max length of the string. but the problem is that i have to refer back to the database for the length so that if the database change, my code don't change.
    is there any way to get the max length in the field of the table?
    eg:
    lets say i got a table call Person with column Name(varchar2(66)) and Sex(char(1))
    so how i retrieve the max length of the field Name?
    thanks

    It's quite simple. We can use the PL/SQL %TYPE in our declarations. Check it out...
    SQL> CREATE TABLE small1 (col1 NUMBER, col2 VARCHAR2(3))
      2  /
    Table created.
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE small1_api (pv_string IN VARCHAR2)
      2  AS
      3      l_col2 small1.col2%TYPE;
      4  BEGIN
      5      l_col2 := pv_string;
      6      INSERT INTO small1 (col1, col2)
      7      VALUES (a12.NEXTVAL, l_col2);
      8  EXCEPTION
      9      WHEN value_error THEN
    10          dbms_output.put_line('oops! string is too long');
    11  END;
    12  /
    Procedure created.
    SQL> EXEC small1_api('APC')
    PL/SQL procedure successfully completed.
    SQL> EXEC small1_api('APC4')
    oops! string is too long
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ROLLBACK
      2  /
    Rollback complete.
    SQL> ALTER TABLE small1 MODIFY (col2 VARCHAR2(4))
      2  /
    Table altered.
    SQL> ALTER PROCEDURE  small1_api COMPILE
      2  /
    Procedure altered.
    SQL>
    SQL> EXEC small1_api('APC4')
    PL/SQL procedure successfully completed.
    SQL> EXEC small1_api('APC45')
    oops! string is too long
    PL/SQL procedure successfully completed.
    SQL> Cheers, APC

  • Limit string-length in Reporting Data Source

    Hello,
    we want to report some attributes to the BI. For this we use the standard reporting activity in the BPM. After we done a lot of configuration on the CE and the BI we achieved to connect the two systems. All attributes are passed correctly to the BI and now we have a problem with the string-length we pass to the BI. The string-length they get from the CE is 512 but the BI can only handle strings with a 60-length. Is it possible to limit the length of a string in the BPM or the CE?
    Manuel

    Hello Jun,
    I have created reporting data source in my BPM where my parameter defined is of type "STRING'.
    This data source is accessed by BW system for reporting purpose where they get an error as below -
    "STRING/XTRING types used Not supported by currently selected access method UDCGEN; cannot use this method"
    Looks like BW does not support string type, how can we make this datatype compatible?
    Please share if you have any idea.
    Thanks,
    Priya

  • Get matched string problem

    i have a simple question
    i want to find string which has roman and cryillic letters inside
    for example
    '04556888A321212V' (A in roman,V in cryillic) matched case
    '04556888A321212S' (A in roman,S in roman) nn matched case
    i want to get first string
    thanks in advance

    I'm not so sure about your problem. But are you looking for this?
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>
    satyaki>with data
      2  as
      3    (
      4      select 'ABCDEFGHIJKLMNOPQRlmnopqrstuvxyz' cola from dual
      5      union all
      6      select 'ÀÁÚÄÅÔÝÙÈÆÊËÌÍÎÏÃÐÑÒÓóâõéç' from dual
      7      union all
      8      select 'ABVCHDYÎÏÃÐÑÒ' from dual
      9    )
    10  select case
    11           when length(translate(cola,'ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz',' ')) < length(cola)
    12           and  length(translate(cola,'ÀÁÚÄÅÔÝÙÈÆÊËÌÍÎÏÃÐÑÒÓÂÕÉÇàáúäåôýùèæêëìíîïãðñòóâõéç',' ')) < length(cola) then
    13             'Matched Case...'
    14         else
    15           'Non Matched Case...'
    16         end res
    17  from data;
    RES
    Non Matched Case...
    Non Matched Case...
    Matched Case...
    Elapsed: 00:00:04.30
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • 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

Maybe you are looking for

  • Issue while creating repair order via IW52

    Hi All,          I am facing an issue while creating a repair order from Service Notification. In IW52 for service Notification , we have option of Create repair order in Action box of service notification, when i am clicking that i need to enter the

  • OAS 4.0.8.2 on NT - OAS not starting

    I have installed Oracle8i (8.1.6),OAS 4.0.8.2 on NT 4.0 Server with SP5. Then I logged into the Oracle Application Server Manager, and tried to start "ALL" as mentioned in the documentation. I got the following message: Site Please wait while the com

  • Single User Outlook 2013 new setup fails on "Logging on to the mail server"

    Auto-discover works fine, Establishing network connection - green check, Searching for the user - green check, then on login it fails with "The connection to Microsoft Exchange is unavailable.  Outlook must be online or connected to complete this act

  • Adobe Digital Editions 2.0 will not run

    It used to run.  I used it to download e-books, but now I am told that it is an incompatable program.  What do I need to do.  I have tried to restart it.  I uninstalled it and reinstalled it, and I installed an older version and tried up upgrade it. 

  • Standard text in smartforms

    Hi, I tried to create a standard text  in russian language.But the characters are coming as ???? . Please give me solution