Percent Format - in a custom string

Post Author: rjstassi
CA Forum: Formula
I have a custom field with the string "("&&"Complete)"
the formula works - however, I need the rounded to the whole percent i.e. 41.67 => 42 and I need the % symbol. I know I can add the '%' symbol into the string portion, but I cannot round the number as it becomes recognized as a string.
Rick in Sacramento

Post Author: bettername
CA Forum: Formula
There's two spring-to-mind options:
1:  Place a textbox on the page, type in the text bits "( % Complete)" and then drag+drop the field into the middle of the text string in the textbox.  You can then format the number portion of the textbox as another other normal number field.  I prefer to leave the % sign as part of the textbox rather than as part of the number formatting.  For no particular reason, mind you.
2: Change the formula to be:   "("&totext(,0)&" % Complete)".  This will convert the number to text (the ,0 bit rounds it) and allows it to be concatenated with other bits of text.

Similar Messages

  • Jspinner with percent formatting

    Hi, I want to make a jspinner but with percent formatting. Here is the code:
        private void SetUpSpinner() {
            NumberFormat percentEditFormat;
            NumberFormat percentDisplayFormat;
            percentEditFormat = NumberFormat.getNumberInstance();
            percentDisplayFormat = NumberFormat.getPercentInstance();
            NumberFormatter percentEditFormatter =
                    new NumberFormatter(percentEditFormat) {
                public String valueToString(Object o)
                      throws ParseException {
                    Number number = (Number)o;
                    if (number != null) {
                        double d = number.doubleValue() * 100.0;
                        number = new Double(d);
                    return super.valueToString(number);
                public Object stringToValue(String s)
                       throws ParseException {
                    Number number = (Number)super.stringToValue(s);
                    if (number != null) {
                        double d = number.doubleValue() / 100.0;
                        number = new Double(d);
                    return number;
            jformattf = new JFormattedTextField(
                                 new DefaultFormatterFactory(
                                    new NumberFormatter(percentDisplayFormat),
                                    new NumberFormatter(percentDisplayFormat),
                                    percentEditFormatter));
            Integer value = new Integer(10);
            Integer min = new Integer(0);
            Integer max = new Integer(100);
            Integer step = new Integer(1);
            SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
            CommisionSp.setEditor(jformattf);
            CommisionSp.setModel(model);
        }If I comment the CommisionSp.setEditor(jformattf); line, the jspinner works fine but without percent format. But if I add that line.... the increase and decrease button does not work at all although I can edit the jspinner directly and when the jspinner lost the focus, my number will be formatted to be percentage formatting.
    Any solution???
    Thank you.

    is this what you're trying to do?
    import javax.swing.*;
    class Spin extends JFrame
      public Spin()
        super("Spin");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(200,75);
        setLocation(400,300);
        JSpinner spinner = new JSpinner(new SpinnerNumberModel(0,0,1,.01));
        JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner,"0%");
        spinner.setEditor(editor);
        JPanel jp = new JPanel();
        jp.add(spinner);
        getContentPane().add(jp);
      public static void main(String[] args) {new Spin().setVisible(true);}
    }

  • Format of the initialization string does not conform to specification starting at index 97 while uploading .xlsx file

    Format of the initialization string does not conform to specification starting at index 97.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 97.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Hello,
    The Windows Desktop Perfmon and Diagnostic tools forum is to discuss performance monitor (perfmon), resource monitor (resmon), and task manager, focusing on HOW-TO, Errors/Problems, and usage scenarios.
    Since your post is off-topic, I am moving it to the
    off topic forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Sending/Reading custom Strings in HTTP Header

    Hey people,
    I'm developing a J2ME application in which I'm trying to send a Message object (a few Strings such as Content, Nickname etc) to a Servlet. Serialization would be nice but since J2ME doesn't support it, I would have to come up with a custom one. I am looking for an easier way to send the strings I need to the other side.
    Can I use some of the HTTP headers in a POST request set to my custom Strings (using setRequestProperty when constructing them)?
    I know it's probably inefficient or "unethical" but if a dirty trick is what it takes... Since I'm controlling both sides of the connection, I am prepared to make it happen, one way or the other.
    Can someone come up with a viable solution?
    Any help would be greatly appreciated!

    Thank you for your prompt answer.
    I will give it a shot but I fear there's bound to be some trouble:
    1. Since the text messages sent can be of arbitrary size and I will definitely need some extra fields (such as smileys ;), color, etc - you get the gist) the header can be long. Thus, big overhead on a small device. But it sure beats creating byte[] for serialization.
    2. Some of the characters used in the "encoding" of the message, such as ",<,>,?,& etc cannot be used by in the actual body of the message - it would confuse the "decoding" on the other side.
    I might be trying to hit two birds with one stone here but the goal is to get a few "text" attributes across as painlessly as possible (for the device, not me..)
    You gave me food for thought tho, have some $ ;).

  • How can I export formatted text from a string indicator?

    Does someone know how I can export formatted text (i.e., parts of the text have different formatting, such as color, fontsize, etc.) from a string indicator? Using copy/paste does not work, as it only exports unformatted plain text.

    Hello Sparti,
        Thank you for your suggestions, they are all very useful, and I plan to use the HTML feature under Report Generation to export the formatted text from Labview. However, I am still not sure how I can extract the formatted text from a *string indicator* and transfer it to one of those VIs, so that it can be exported to other applications. Let me give some more specific info on what I am trying to achieve:  I am monitoring the communication between two pieces of equipment. A string indicator shows all the data flow, with different colors for data coming from different instruments. I managed to do that by using a property node and playing with the selection and font color properties. Now, if you just wire the output of the string indicator, the formatting is gone and all you get is just plain black text (for instance, try to programmatically transfer the formatted text from one string indicator to a different string indicator and you will see that the formatting is not preserved). Even if you try the "brute force" method of manually selecting and copying the text in the indicator and pasting it to Word, LV does not export the formatting. But, if you paste *within*  LV (for example, paste it to a string constant in your diagram), then it works. To extract the formatted string from the indicator, I also tried to use a property node, but without success. I am trying to avoid duplicating part of my code to generate the same color-coding scheme on a report. It would be way easier to be able to transfer the formatted text from the string indicator. This is particularly annoying, because the information is there, stored in the data structure associated with the string indicator. But how can I put my hands on it? Any ideas?

  • HT3205 In place of the percentage number next to my battery icon, it now says "single percent format." What does this mean and what do i do about it?

    In place of the percentage number next to my battery icon, it now says "single percent format." What does this mean and what do i do about it?

    You can use a keyboard command to prevent your iPod auto-syncing with iTunes. While connecting the iPod to the computer on a Mac hold down the Option and Command (⌥ and ⌘ Apple) keys together. This will stop the iPod from auto-syncing with iTunes and it will appear in the source list. Wait until you are sure the iPod has mounted, and that it will not auto sync and then you can let the keys go. This may take between 20 to 30 seconds depending on your computer. Once you are safely connected go to the iPod Summary tab and make sure "manually manage music and videos" is checked:
    iTunes for Mac - Keyboard Shortcuts
    Managing content manually on iPod and iPhone

  • Formatting a timestamp into string with $ specifier

    Formatting a timestamp into string with $ specifier does not work; the formatted string is empty and no error is reported:
    I have forced the width to 10 to show that the format is at least partially scanned but when it is omitted the timestamp field is empty.
    I couldn't find this problem reported/addressed so here it is (LabVIEW 8.6)
    LabVIEW, C'est LabVIEW

    Yes, the simple work around is to put the timestamp first in both the string and the inputs.  But this is a bug.  There is no doubt about that.  A high priority?  Probably not.  Something that should be looked for when doing a revamp of the Format String?  Yep.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How do I strip off a time format off of a string array

    How do I strip off a the first part of a time format out of a string array. The following is what it looks like
    14 April 2008 10:00:00.000, 30.000,128.591,-145.839
     "       "      "     10:00:01.000, "              "              "
    I tried the read from speadsheet file first. I tried lower level VIs. There must be something simple I am just missing.

    Search for the first comma and take the data before it.
    Message Edited by Ravens Fan on 12-10-2008 04:50 PM
    Attachments:
    Example_VI_BD.png ‏2 KB

  • Formatting of the GUID string.

    Dear gurus, I already get good help for other problem. I hope to follow guidelines this time.
    In our firm we have to deal with the GUID. Now, the GUID come in 3 formats (see the other posting
    of the GUID in this newsgroup). I have the several GUIDS as below
    with mydata as (
    select '77DB966B620D4FEBB9959D016E0BD590' as guid from dual union
    select '159F25C035E845CFA95CFF4F3365B330' from dual union
    select '0485FA87A2FF445E965333B6980EC176' from dual)
    select guid from mydata;Now, instead of the phrase "select guid from mydata" what I wish for is to have the
    select regexp_replace(guid, xxxxxxxxxxxx, yyyyyyyyyyyy, zzzzzzzzzzz) from mydata for the following of the result.
    desired result
    select regexp_replace(guid, xxxxxxxxxxxx, yyyyyyyyyyyy, zzzzzzzzzzz) from mydata;
    77DB966B-620D-4FEB-B995-9D016E0BD590
    159F25C0-35E8-45CF-A95C-FF4F3365B330
    0485FA87-A2FF-445E-965333B6980EC176
    and also desired result - difference in expression
    {77DB966B-620D-4FEB-B995-9D016E0BD590}
    {159F25C0-35E8-45CF-A95C-FF4F3365B330}
    {0485FA87-A2FF-445E-965333B6980EC176}the needing is as the follows: put the - (hyphen charachter) at 8, 12, 16, 20 in the GUID string
    and also possible choose add the bracket cureley { } at beginning end of string. I am not very strong
    (still doing the learning) of the regular expressions. If any guru can help, I would be most grateful.
    Jehangir.

    Hi, Jehangir,
    Here's how to do that using REGEXP_REPLACE:
    SELECT  guid               AS raw_guid
    ,     REGEXP_REPLACE ( guid
                     , '{\1-\2-\3-\4}'
                     )     AS formatted_guid
    FROM    mydata
    ;Results, given the sample data you posted:
    RAW_GUID                         FORMATTED_GUID
    0485FA87A2FF445E965333B6980EC176 {0485FA87-A2FF-445E-965333B6980EC176}
    159F25C035E845CFA95CFF4F3365B330 {159F25C0-35E8-45CF-A95CFF4F3365B330}
    77DB966B620D4FEBB9959D016E0BD590 {77DB966B-620D-4FEB-B9959D016E0BD590}In the 3rd argument to REGEXP_REPLACE, the curly brackets have no special meaning. You can use them like any plain character.
    You could also get the same results using SUBSTR, which will probably be a little more efficient.
    Jehangir Khan wrote:
    Dear gurus, I already get good help for other problem. I hope to follow guidelines this time.
    In our firm we have to deal with the GUID. Now, the GUID come in 3 formats (see the other posting
    of the GUID in this newsgroup).Copy the relevant information into this thread, or at least post a link.
    I have the several GUIDS as belowSorry, I don't understand. What is the difference between the 3 formats? All the strings you posted seem to have the same format.
    >
    with mydata as (
    select '77DB966B620D4FEBB9959D016E0BD590' as guid from dual union
    select '159F25C035E845CFA95CFF4F3365B330' from dual union
    select '0485FA87A2FF445E965333B6980EC176' from dual)
    select guid from mydata;Now, instead of the phrase "select guid from mydata" what I wish for is to have the
    select regexp_replace(guid, xxxxxxxxxxxx, yyyyyyyyyyyy, zzzzzzzzzzz) from mydata for the following of the result.
    desired result
    select regexp_replace(guid, xxxxxxxxxxxx, yyyyyyyyyyyy, zzzzzzzzzzz) from mydata;
    77DB966B-620D-4FEB-B995-9D016E0BD590
    159F25C0-35E8-45CF-A95C-FF4F3365B330
    0485FA87-A2FF-445E-965333B6980EC176the needing is as the follows: put the - (hyphen charachter) at 8, 12, 16, 20 in the GUID stringThe last row only has 3 hyphens in the output. Why is that one different? Is that an example of a different one of the 3 formats?
    Edited by: Frank Kulash on Jul 16, 2012 10:41 AM

  • Customized strings in iPad viewer not working?

    Hello,
    per request of client i've tried to change one string in viewer for iPad. So i've created template in DSP App Builder, modified this template on my computer, choose this file in App Builder and prepared another build (V28). Unfortunately, i still see old original string (i've double tested that i'm downloading new version of app). When i now check DPS App Builder, it just says "Asset stored on server", so i asume, that everything goes smoothly on this side.
    Any similar experience with customized strings?
    Thanks
    Martin

    Everything was done from scratch with V28.
    1. 10. 2013 v 16:14, Bob Bringhurst <[email protected]>:
    Re: Customized strings in iPad viewer not working?
    created by Bob Bringhurst in Digital Publishing Suite - View the full discussion
    That's odd. It worked for me when I tested it. Perhaps you should try moving the current xml file to a different folder, downloading a new version, copying and pasting, and rebuilding.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5728130#5728130
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5728130#5728130
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5728130#5728130. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Digital Publishing Suite at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Output custom string to SAX TransformerHandler

    Hi
    How can I output a custom String to a SAX TransformerHandler? I don't think my string is valid XML but I want to add it anyway.
    The String I want to add is: "<?import namespace="t" implementation="#default#time2">"
    Can I do it by writing using the characters method? E.g. something close to:
    myTransformerHandler.characters("<?import namespace=\"t\" implementation=\"#default#time2\">".toCharArray(),
                                      0,
                                         "<import namespace=\"t\" implementation=\"#default#time2\">".length());     This doesn't work because the < are replaced with &lt; etc.
    Thanks
    /Kristofer

    Maybe this question was too easy to deserve an answer or perhaps it was not answered because I was asking the wrong question. Anyways.. Elements with questionmarks are really "XML processing instructions" and the line above can be added with the line:
    myTransformerHandler.processingInstruction("import", "namespace=\"t\" implementation=\"#default#time2\"");

  • How to convert the output of Applescript which is in object format to text or string format??

    Hi All,
    I want to convert the output of Applescript which is in object format to string or text format, am running Applescript with Java, I need to display the output of applescript in Eclipse Java Console, since its object format the output is not properly displayed..
    Pls suggest.. I used the below code
    repeat with i in allContents
                if class of i is button then set the end of allStaticText to contents of i
            end repeat
    Applscript ouptput
    {button 1 of window "Player Installer" of application process "Install  Player" of application "System Events", button 2 of window "Player Installer" of application process "Install  Player" of application "System Events", button 3 of window "Player Installer" of application process "Install  Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Player Installer" of application process "Install  Player" of application "System Events"}
    Java output
    <NSAppleEventDescriptor: 'obj '{ 'form':'indx', 'want':'butT', 'seld':1, 'from':'obj '{ 'form':'name', 'want':'cwin', 'seld':'utxt'(" Player Installer"), 'from':'obj '{ 'form':'name', 'want':'pcap', 'seld':'utxt'("Install  Player"), 'from':'null'() } } }>

    Here's an improved version of the previous script, where the handler now returns "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"" instead of "button \"2\" of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"":
    tell application "System Events"
        get button 2 of window 1 of process "TextEdit"
        my objectToText(result) --> "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\""
    end tell
    on objectToText(UI_element)
        set theText to ""
        tell application "System Events"
            repeat
                if exists attribute "AXParent" of UI_element then
                    set theParent to value of attribute "AXParent" of UI_element
                    set theClass to class of UI_element
                    if name of UI_element exists then
                        set theName to name of UI_element
                        set theText to theText & (theClass as text) & " \"" & theName & "\" of "
                    else
                        set k to 0
                        get UI elements of theParent whose class is theClass
                        repeat with thisItem in result
                            set k to k + 1
                            if contents of thisItem is UI_element then exit repeat
                        end repeat
                        set theIndex to k
                        set theText to theText & (theClass as text) & " " & theIndex & " of "
                    end if
                    set UI_element to theParent
                else
                    set theClass to class of UI_element
                    set theName to name of UI_element
                    set theText to theText & (theClass as text) & " \"" & theName & "\" of application \"System Events\""
                    exit repeat
                end if
            end repeat
        end tell
        return theText
    end objectToText
    Message was edited by: Pierre L.

  • Date format issue in Custom Pages

    Hi All
    I have set ICX: Date Format profile option as 31-Dec-1999 and under preferences set the date format as DD-MM-YYYY. But still in my custom pages when i fetch data and show it shows in the format YYYY-MM-DD. Could anyone please tell me is it the default mask for OAF. If so then what is the significance of setting preference format mask when it does not get reflected.Please help.
    Thanks
    Raj

    Hi Sachin,
    where did you set the SET COUNTRY in the layout?
    It should be in the Initialization tab in the Global defnitions. Please confirm that.
    Regards,
    Selva K.

  • Printing envelope not formatted correctly on custom size 8.75 by 5.75

    Printers and All-In-Ones running win 7 64 bit, officejet 8600 pro all update current, In works 2007 word processor or 2011 Hallmark card progam.  downloaded latest driver and reinstalled same (deleted original dr and rebooted first). Envelope is correctly positioned, address prints at top of flap side return address is missing.  On plain paper (8.5X11) test print, address & return address appears to be in correct position.

    I have the same problem with the same size paper (aka Invitation or Statement size), and have an additional problem with printing to the corresponding envelope size which is a Standard A9 (5.75"x8.75"). These are both standard size papers for the U.S. and are used in printing wedding invitations. I don't understand why there are programmed sizes for Japanese stationary, but not for all standard U.S. size formats (that will fit in the main feed tray) or the ability to create a Custom Size format.
    Because these features weren't available, I ended up paying a local printer to print my New Year's cards (an expense I wasn't anticipating that equaled half the purchase price of the printer). And, since I can't print on the envelopes I will need to print labels, which I was hoping to avoid because I hate applying labels to envelopes.
    HP, please update the software to allow customers to print to all appropriate Standard Size US formats or allow for customization, otherwise my next printer will be purchased from a manufacturer that does provide this ability.

  • Translating a date format in a filename string

    Hi,
    Basically I have a property like:
    filename=MyFile(yyyy-MM-dd@HHmmss).logWhen I create the file I want to translate the embedded date format string using the current date.
    My solution is as follows:
       private static void createFile(String fName) {
          String[] fNameArray = new String[3];
          int openBracket = fName.indexOf("(");
          int closeBracket = fName.indexOf(")");
          // Split the file name into prefix, text inside brackets ie to be tranlated to a date and suffix
          fNameArray[0] = fName.substring(0, openBracket+1);
          fNameArray[1] = fName.substring(openBracket+1, closeBracket);
          fNameArray[2] = fName.substring(closeBracket);
          String dateFormat = fNameArray[1];
          DateFormat df = new SimpleDateFormat(dateFormat);
          String date = df.format(new Date());
          fNameArray[1] = date;
          fName = fNameArray[0].concat(fNameArray[1].concat(fNameArray[2]));
          ...This seems a little long winded to me (it works though). Does anyone know of a simpler way to code this?
    Many Thanks

    I've been looking around and came across String.format() which can be used to format strings using substitutions variables.
    This works a treat but I must admit the property now looks a bit complex!
       String fName = "MyFile_%1$tY%1$tm%1$td%1$tH%1$tM%1$tS.log";
       fName = String.format(fName, Calendar.getInstance());
       // fName = MyFile_20060803132200.logThanks for your help.

Maybe you are looking for