Process calculation from text

Hi,
I there an easy way to process a calculation that is in text form as in:
"2567 + 82736"
"1000 * (27363 / 38374)"
"3434 + 34334  + 34332 + 83938"
Or do the strings have to be parsed and processed that way.  I was hoping there was a way to evaluate the calculation?
thanks.

Thanks for responding guys.  Evaluate doesn't work (at least not the way I've tried it).  E.g. 
<cfset val = 1>
<cfset vall = 2>
<cfset op = "+">
<cfset new_expr = "1 + 2">
#evaluate("new_expr")# resolves to "1 + 2"
#evaluate("val #op# vall")# resolves to "3"
So unless there are any other ideas, I guess I will have to parse.  You'd think there'd be an easier way :-(   Thanks again.

Similar Messages

  • How to create Button which size is calculated from its text ?

    I think JButton works like this: either in constructor or by setText() method the text is set and according the lenght, font and fontRendererContext preffered size is calculated before the layout manager ask for the prefferedSize for first time.
    I want to override paint() method because i want to draw my own text(and the only way i discovered how to force button not to paint text is to set text to
    null or empty String). I want the button to be as long as length of text plus insets.
    But layout manager ask for preffered size before paint method is invoked but i find out what size should be in paint method because i need graphics
    parameter to get FontRendererContext from it. So layout manager shrink button to minimum because first time the preffered size calculated from null or
    empty String is returned.
    public class MyButton extends JButton {
            public MyButton() {
                this.setText(null);  //or setText("");
                this.setContentAreaFilled(false);
                this.setFocusPainted(false);
                this.setBorderPainted(false);
                                                          ////already here i need to know what the size should be
            @Override
            public void paint(Graphics g) {
                Graphics2D g2 = (Graphics2D) g;
                TextLayout textLayout = new TextLayout("MyButton", this.getFont(), g2.getFontRenderContext());
                Rectangle2D boundsOfText = textLayout.getBounds();                                                                    /////////here i find out what size should be
                this.prefferedSize = new Dimension((int)boundsOfText.getWidth()+10,(int) boundsOfText.getHeight()+10);
                g2.setColor(Color.WHITE);
                g2.fillRoundRect(1, 1,(int)getPreferredSize().getWidth(),(int) getPreferredSize().getHeight(), 10, 10);
                g2.setColor(Color.BLACK);
                g2.drawRoundRect(1, 1,(int)getPreferredSize().getWidth(),(int)getPreferredSize().getHeight(), 10, 10);
                g2.drawString("MyButton", 7, (int)boundsOfText.getHeight() + 6);
                g2.dispose();
        }So how can i do that? How can JButton know prefferedSize before its paint method is invoked?

    The previous example was simplified.
    public class MyButton0 extends JButton {
        private String myText;
        public MyButton0(String text) {
            this.myText = "Button";
            //this.myText = text.toUpperCase();
            this.setFont(new Font("SansSerif", Font.PLAIN, 13));
            setContentAreaFilled(false);
            setBorderPainted(false);
            setFocusPainted(false);
        @Override
        public void paint(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            //backround painting
            GradientPaint background = new GradientPaint(0, 0, new Color(255, 255, 255), 0, getPreferredSize().height / 2, new Color(0, 0, 0), true);
            if(getModel().isRollover()){
                background = new GradientPaint(0, 0, new Color(255, 255, 255), getPreferredSize().width , getPreferredSize().height , new Color(0, 0, 0), true);
            if(getModel().isPressed()){
                background = new GradientPaint(0, 0, new Color(255, 255, 255), 0, getPreferredSize().height / 2, new Color(210, 210, 210), true);
            g2.setPaint(background);
            g2.fillRoundRect(1, 1, getPreferredSize().width - 3 , getPreferredSize().height - 3, 10, 10);
            //Border painting
            g2.setColor(new Color(255, 255, 255));
            g2.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.CAP_BUTT, 10.0f));
            g2.draw(new RoundRectangle2D.Double(1, 1, getPreferredSize().width - 3, getPreferredSize().height - 3, 10, 10));
            //text paiting
            g2.setFont(getFont());
            TextLayout tl = new TextLayout(this.myText, getFont(), g2.getFontRenderContext());
            int startPositionOfText = getPreferredSize().width - (int) tl.getBounds().getWidth();
            startPositionOfText = startPositionOfText / 2;
            g2.setColor(new Color(255, 255, 255));
            g2.drawString(this.myText, startPositionOfText -2, getHeight() / 2 + 5);
            g2.dispose();
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(133, 31);
    }Assume text is so long as doesn't fit inside button. I have hard-set preffered size but i would like to calculate preffered size from text lenght.
    Or i need calculate startPosition of text to center it. But i don't want have preffered size hard-set.

  • How to find largest number from text file

    I am using the "Read from text file" block to read the data from my .txt file into labview.  It is now in string format.  I have many numbers in the file.  
    For example:
    0.45
    0.35
    0.12
    1.354
    1.56
    2.89
    5.89
    0.56
    That is what a text file might look like.  I want to find which of these numbers is largest, and do calculations with that number.  I am having trouble with strings/number formats/arrays, etc.  Thanks
    Solved!
    Go to Solution.

    The spreadsheet functions and VIs typically work on strings representing numbers separated by delimiters.  This is a typical way to save a "spreadsheet" (of numbers) to a text file, for example .csv files.  These are quite versatile and powerful functions.  Spend a bit of time becoming familiar with them because you may find yourself using them a lot.
    Lynn

  • Good for processing data from a web application?

    It seems like all the examples provided for ASA are about processing data streaming in from IoT or mobile apps. Is ASA appropriate for processing data from websites? For example, I have a multi-tenant web API and I need to roll up usage and calculate billing
    for my clients. My clients can upload resources with me which I store in blob storage. But blob storage gives me no way of knowing how many resources have been uploaded and how long I have stored them. Would ASA be a good fit for calculating these figures?

    I have solved this task in folowing way:
    I have add ADF read only form to my page (which I need anyway). The form displays data selected in the graph (using another VO, which is linked to graph VO). Command button calls my managed bean, which handles the data via the bindings executables (view iterators).

  • Switching from text view to visual view in SharePoint Designer 2013 crashes 100% of the time

    Whenever I am in SharePoint Designer 2013 and try to switch a workflow from text view to visual view, SharePoint Designer crashes. Text workflows work fine. I have tried any of the solutions that I could find including:
    - Removing KB2837633 and 2768006 (neither were installed)
    - Installing SharePoint Designer 2013 SP1 (KB2817441)
    - Performing a "Repair" on both SharePoint Designer 2013 and Visio 2013
    - Clearing the caches in the AppData directory
    - Setting Visual as the default mode for workflows to open in (so, not exactly switching, but trying to open it directly in the visual view)
    Event viewer reports that it is an issue with Microsoft.Web.Authoring.ni.dll which throws an unhandled exception, System.AccessViolationException.
    This is the error message:
    System.AccessViolationException was unhandled
      HResult=-2147467261
      Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
      Source=Microsoft.Web.Authoring
      StackTrace:
           at Microsoft.Web.Authoring.Workflow.XamlWrapper.GetStageInfo(UInt32 node, String& name, UInt32& transition, UInt32&
    stageContainer)
    There is no InnerException.
    Can anyone suggest something else to try?
    Thanks!

    Hi,
    I have checked out the links above to no avail. I will keep looking. I have included the details from event viewer below.
    Details from event viewer:
    Event ID 1001
    Fault bucket , type 0
    Event Name: APPCRASH
    Response: Not available
    Cab Id: 0
    Problem signature:
    P1: SPDESIGN.EXE
    P2: 15.0.4569.1503
    P3: 52b0b061
    P4: Microsoft.Web.Authoring.ni.dll
    P5: 15.0.4531.1000
    P6: 51cb6bd8
    P7: c0000005
    P8: 0012f4b8
    P9:
    P10:
    Event ID 1000
    Faulting application name: SPDESIGN.EXE, version: 15.0.4569.1503, time stamp: 0x52b0b061
    Faulting module name: Microsoft.Web.Authoring.ni.dll, version: 15.0.4531.1000, time stamp: 0x51cb6bd8
    Exception code: 0xc0000005
    Fault offset: 0x0012f4b8
    Faulting process id: 0xc3c
    Faulting application start time: 0x01cf69f7dfc05fc8
    Faulting application path: C:\Program Files (x86)\Microsoft Office\Office15\SPDESIGN.EXE
    Faulting module path: C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\Microsoft.W7830ee34#\bed75c80b5bf64ca619a88ad4a48b674\Microsoft.Web.Authoring.ni.dll
    Report Id: 45c4e398-d5eb-11e3-8ff3-7054d21a367e

  • Changing standard output from Text to XML customization?

    Hi Team,
    We wanted to get an excel output for a standard reports Accounts Payables Trial Balance, we changed the output from Text to XML. We did not attach a data definition or template definition ..we just wanted to see the XML output.. We got an error in the process ."Caused by: oracle.xdo.parser.v2.XMLParseException: '=' missing in attribute" .. for which we raised a TAR..
    We were told in the TAR that changing the standard output from Text to XML is customization!!!!... can you please clarify if this is the case..

    Hi
    Is this issue get resolved ???
    Thanks
    Shivdeep Singh

  • Condition Type for item calculated from delivery date

    Dear Experts,
    We need that the condition type MWST for PO item will be calculated from Item delivery date ,
    But we see that always in Analysis pricing the efected date is PO date and not item delivery date .
    Please advise how we should configure the condition ?
    Thanks,
    Moshe

    Hi,
    In standard configuration you cannot set item delivery date as a pricing data.
    Maybe you shoud look at SAP enchancement - in dedicated structures you can pass additional item data (structure KOKMP).
    IMG link:
    Materials Management -> Purchasing -> Conditions -> Define Price Determination Process -> System Enhancements
    hope it helps.
    regards,
    wojciech

  • Rebate calculation from Basic Price PR00

    Hi,
    This query is related to rebate conditions. At present the rebate base is calculated from the subtotal, that is Basic price - discount(The subtotal 7 is assigend to the step 300).
    As per the requirement from the business, the rebate should be calculated from the 'Basic Price'. They don't want the discount value should be considered in the rebate calculation. I explained them regarding the burden which company has to bear, but the business still want to go with the changes.
    My plan is to create another step in the pricicng procedure right after the basic price and assign subtotal 7 to it and delete the exting reabte subtotal step, and assign the new step number to rebate conditions, so the reabte will be calculated based on this.
    My questions are:-
    1. Can I edit the existing pricing procedure to make these changes?
    2) Will there be any impact on the existing rebate agreements (open) and its settlements on a later date?
    3) Will there be any impact on the process of billing of open sales orders/deliveries (not billed) after the change in pricing procedure?
    Please guide me.
    Regards,
    SAM

    Hi Ivano,
    Thnak you very much for your suggestion.
    As the note says, the best way is to copy the existing pricing procedure and create another and assign it in OVKK.
    Will there be any effect for partially billed delivery items? (at the time of creation of billing document for the unbilled items in the delivery)
                                                                        OR
    when we create a billing document from the delivery (in the case of sales order and delivery created with old pricing procedure and the billing document is getting created after the assignment of new pricing procedure)
    Your valuable suggestions will be highly appreciated.
    Regards,
    SAM

  • Executing Business Rule / Calculation from Excel - Essbase

    Hi All,
    Currently I am trying to run the calculations / Business rules from essbase after locking and sending data. I am using the below code to run the business rule / calculation from essbase.
    Sub RunBusinessRule()
    On Error Resume Next
    X = EssVCalculate(Empty, "AggFlash", False)
    MsgBox "Business Rule executed successfully"
    End Sub
    The issue is that my code gives me a message that the business rule is executed successfully but the rule keeping running in the background for some time. Actually i need a code which will check the status of the process of calculation and when it actually gets completed I should get a message that it's been done. Please expedite.

    Hi,
    I take it you mean calc script and not business rule as really they are separate.
    The reason you get a message straight away is because you have the synchronous parameter set to false, if you set it to true it should not return until it is comple
    e.g.
    X = EssVCalculate(Empty, "AggFlash", True)
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • A column that's calculated from the previous three columns

    I have written this query and it runs perfectly:
    ============================================================
    Select ProductName, ListPrice, DiscountPercent, ListPrice - DiscountPercent AS DiscountAmount
    From Products
    ==================================================================
    Now I need  to add this line to this query: DiscountPrice calculated from (ListPrice - DiscountAmount).   But I keep getting errors:
    Select ProductName, ListPrice, DiscountPercent, ListPrice - DiscountPercent AS DiscountAmount
    ListPrice - DiscountAmount AS DiscountPrice
    (Get Errors on ListPrice; Msg 102, Level 15, State 1, Line 3
    Incorrect syntax near 'ListPrice'.)
    From Products

    You need to repeat the ListPrice formula in your DiscountPrice formula (the most efficient way to handle this formula).  The alias ListPrice is not available until after the select is complete.
    See the
    http://www.sql.co.il/books/insidetsql2008/Logical%20Query%20Processing%20Poster.pdf (Logical Query Processing).
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • What's the keyboard shortcut for "Extrusion from Text Layer"? (Mac CS6)

    I keep triggering this by accident and can't figure out what combo I'm hitting, or how to disable it. I've looked in the Keyboard Shortcuts but can't find it.
    I'm on a laptop keyboard, so I use the fn key a lot to access enter when I'm finished editing text. Every once in a while (but often enough to be annoying), I attempt to enter out of text editing and suddenly everything stops, the gray rotating "processing" cursor appears, and for a few seconds I'm in a mild panic about how long it's been since I saved. Then a dialog box comes up asking if I want to switch to the 3D workspace or something. Clicking "no" doesn't stop the unwanted 3D thing from happening, and the last History item then says "Extrusion from Text Layer." I then Undo and go on with what I was doing.
    I've always got my left hand positioned over the lower left corner of the keyboard, and move quickly when using shortcuts and switching tools. I have no idea what combination I keep hitting by accident - something with fn, ctrl, opt, cmd, shift, I don't know, plus possibly return or enter. What is it, and how do I disable it?

    Trial-and-error prevails: It's fn + shift + return. (Or shift + enter on a full keyboard, I suppose? Unless that still does a soft line break like shift + return.)
    But only when I'm actively editing the text layer - not with the text layer selected and Move tool active, or even with the text layer selected and Type tool active, but only when in the process of using the Type tool to edit the text layer. I still have no idea to disable it, though.

  • Bug when converting from text to date

    Hello Guys,
    I have a table with about 700 rows and the first column is for date.
    Most rows correctly have the cell content as date, but some rows show it as text, and even when I try to change it to date, nothing happens. It sticks as text.
    Main problem is I can't sort correctly of even do calculations.
    For me it really seems to be a bug.
    The only solution I see is to create a new column to convert the values with formula, but this is a shame to need to do this to workaround such simple bug.
    Best regards,
    Bruno

    Hi Wayne,
    LOL.
    Here's the cell that came from text file exactly like the next one. After setting as date in the format panel, it stays as expected:
    The row below came from another paste from the same text file, but it insists on not becoming date:
    After setting date, and leaving the cell selection, it goes back to "Automatic".
    In the bar at the bottom, it is shown as "Text".
    I have already tried to select the entire column and set as Date, and also to do it individually, but only some are converted. Other stays as Texts.
    Best regards,
    Bruno

  • Find total processing time from routing

    Hi,
    I'm writing specs for creating a production scheduling report for sales orders. I'm stuck at finding the relevant tables and fields for this particular calc. I want to find the processing time from routing.
    Total Processing Time (if Procurement type = u201CEu201D, then all operations from tasklist/Routing Operations for the material number) = Setup Time + (Machine time * Operation Quantity) + (Labor time * Operation Quantity)
    Any suggestions??
    Thanks

    Hi
    Check with any one of the following table:
    EAPL     Allocation of task lists to pieces of equipment
    EINA     Purchasing Info Record: General Data
    EINE     Purchasing Info Record: Purchasing Organization Data
    ESKL     Account Assignment Specification: Service Line
    ESLH     Service Package Header Data
    ESLL     Lines of Service Package
    INOB     Link between Internal Number and Object
    KALC     Material Quantity Calculation - Formulas
    KALT     Material Quantity Calculation: Header
    KOCLU     Cluster for conditions in purchasing and sales
    KSSK     Allocation Table: Object to Class
    LFA1     Vendor Master (General Section)
    MAPL     Assignment of Task Lists to Materials
    MLST     Milestone
    MLTX     Milestone Description
    PLAB     Relationships
    PLAS     Task list - selection of operations/activities
    PLFH     Task list - production resources/tools
    PLFL     Task list - sequences
    PLFT     Process Instructions
    PLFV     PI Characteristics/Sub-Operation Parameter Values
    PLKO     Task list - header
    PLKZ     Task list: main header
    PLMK     Inspection plan characteristics
    PLMW     MAPL-Dependent Charac. Specifications (Inspection Plan)
    PLMZ     Allocation of bill of material items to operations
    PLPH     CAPP: Sub-operations
    PLPO     Task list - operation/activity
    Thanks
    Saravana
    Reward if useful

  • Exporting Design steps of Business Process Components from QC to excel using macro

    I want to export design steps from Business Process Components from QC to excel using macro. CAn anyone please help me with that.
    Thnx, Sanket

    Post Author: swat
    CA Forum: Exporting
    Hi,
    Of what i gather from ur scenario...this is what i did in one of my reports.
    I had to use two subreports and they had to occupy one cell each, in line with other fields.
    To obtain that,all the fields required in the subreport i put them into a text box.Therein restricting the fields to the txt box only...
    Then import that sub-report as it is.
    It worked for me....
    try out...
    All this only if've understood u right...

  • What is the difference between Create shapes or masks from text characters?

    What is the main difference between Create shapes or masks from text characters and why use one over the other, or when is one preferred over the other?
    I am still fairly new to AE and am trying to better understand this, or can you point me to where i might look for the answer?
    CS5 if that make a difference.

    One creates masks, the other creates shape layers. There are properties that you can animate with shape layers that are not available to masks. There are also a few things you can do with masks that you can't with shape layers.
    I'd suggest you take a look at the help files or do a Google Search on After Effects Shape Tutorials.

Maybe you are looking for

  • How to build a report on a table containing ORDSYS.ORDIMAGE type?

    Hi I build a table with a column of type ORDSYS.ORDIMAGE then I build a form using wizard and populate the table by uploading intermedia type and I can make query on that form and see the image. But when I build a report using wizard, the report resu

  • HT201359 What do I do? Can't delete credit card from iTunes and can't update apps

    I'm having problems with deleting my credit card from my iTunes account. Tried everything possible. I tried making a purchase but it didn't go through so now it's not letting me update my apps. What do I do?

  • Combining word processing and page layout templates

    Does anyone know how to (or if it's possible at all) merge or combine a Pages 09 document set up on the "Pages Layout" template with one set up on "Word Processing" template properly? Can these two templates "talk to each other"? I'm trying to combin

  • Display objects in ALV

    Is it possible to display an internal table of objects using ALV? I've tried to do so using the following code: TYPES object_table_type TYPE TABLE OF REF TO zcl_classname. DATA object_table TYPE object_table_type. ... Fill object_table with objects .

  • I am having issues with Adobe reader on my macbook.

    When I download a pdf and save when I go to open it i get " There was an error opening this document. The file is damaged and could not be repaired"