Error trying to change the value property of a cell with decimals

This is a script question.
I’m using a system defaulting to Spanish, so the decimal delimiter is the comma.
During a script I need to change the property value of a cell multiplying it by -1. As an example, I want to change 1,25 into -1,25.
This is how try to do it:
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
set selection range to first cell
set mi_cell to (value of first cell of selection range) * -1
set value of first cell of selection range to mi_cell
end tell
The expected result is wrong provided that the original value of the cell has decimal value. Otherwise is correct.
See examples of what happen after running this piece of the script:
1,25 becomes -125,00 instead of -1,25
6,00 becomes -6,00 (in this case is correct)
Does anybody know how to solve this problem?
Thanks in advance.
Ratz

This was described here in several scripts.
Before setting the value of a cell to a number or a date, the value must be coerced to a string.
It's the only way available to take care of localization features.
Your script must be
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
set selection range to first cell
set mi_cell to (value of first cell of selection range) * -1
set value of first cell of selection range to mi_cell as text
end tell
or better
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
set mi_cell to (value of first cell) * -1
set value of first cell to mi_cell as text
end tell
CAUTION : don't code
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
set mi_cell to -(value of first cell)
set value of first cell to mi_cell as text
end tell
which is supposed to do the same but would return the opposite of *_the integer value_* of the cell.
Yvan KOENIG (VALLAURIS, France) dimanche 13 février 2011 16:06:39

Similar Messages

  • Dump when changing the value for a field (of 13 decimals) in alv grid.

    Hi Group,
    Its giving a dump when user is trying to change the value.
    dump description: Unable to interpret "70,000 " as a number.
    what is happening here is, the original value is 50,000 and he is deleting 5 and replacing it with 7, here its throwing the dump.
    If he removes the complete number 50,000 and then gives 70000 its  taking the value.
    I tried to use, the decimals options in alv field catalog but to no joy.
    Please can you give me an advice on this.
    Many Thanks.

    the problem is the comma in the 70,000....that's an alpha character.... Normally, we expect SAP to display numeric fields in a appropriate format, based upon their numeric type, but trying to forcibly insert '70,000' into a true numeric-type field can generate an 'unable to interpret xxx,xxxx  as number' error.
    You could experiment with changing your ALV column to a char17 (or appropriate width) and putting your numeric value into that to display, then converting back to type P, or other field type in the table, in a column that is not displayed, when the user changes the value....  essentially two columns, one not displayed with a routine to copy/convert the numeric field into the alpha field and the reverse when the field is changed.
    But, the better solution is probably for the user to understand that they're seeing a formatted numeric field, and that they need to replace the entire value with the only possible punctuation being a decimal and (if necessary) a negative sign.

  • How can I change the value in a stepper cell

    In Numbers 2.3 I was able to change the value in a stepper cell by highlighting the value and using the arrow keys to increase or decrease the value. This was a very easy way to input data. Numbers 3.0 when I do this is moves to another cell
    Is there a way to get the use of the arrow keys to change the values in 3.0?
    Thanks

    I use number to keep a running daily tally of the productivity of the members of my group. As each member performs certain tasks, all I had to do was click the up arrow and add to it. IE Jim made 4 widgets yesterday and then made 4 today, I would just hit the up 4 times total 8.
    I guess the good news is when I upgraded to Numbers 3.0, It did not delete Numbers 2.3
    I will continue to use 2.3 until it no longer works, I guess
    Thanks for the replies

  • Trying to change the color of a single cell

    hi, I am trying to change the color of a single cell when mouse moves over it, but couldn't do it. i even tried my own renderer, but it doesn't work. can anybody help ?

    Here is what I am trying to do. I am displaying some data in a java JTable retrieved from a table in database. What is needed is when user moves his mouse over any cell in the third column, the cursor should change to hand cursor and possibly the background color should also change, to indicate the user that this cell is clickable. I have to show some other report when user clicks any cell in column three. The code follows as
    import java.awt.*;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.sql.rowset.*;
    import javax.swing.table.*;
    public class MouseMotionInTable extends JFrame
    public static void main(String[] args)
      MouseMotionInTable f = new MouseMotionInTable();
      Toolkit tk = Toolkit.getDefaultToolkit();
      Dimension dim = tk.getScreenSize();
      int w = dim.width;
      int h = dim.height;
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setBounds((w-600)/2, (h-300)/2, 600, 300);
      f.setVisible(true);
    MouseMotionInTable()
      Connection con = null;
      CachedRowSet crs = null;
      try
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       con = DriverManager.getConnection("jdbc:odbc:FMS", "", "");
       Statement st = con.createStatement();
       String query = "SELECT ItemName, Alias, ItemReOrderQuty, ItemMeasure FROM ItemInfo";
       ResultSet rs = st.executeQuery(query);
       crs = new com.sun.rowset.CachedRowSetImpl();
       crs.populate(rs);
       st.close();
      catch (SQLException e)
       e.printStackTrace();
      catch (ClassNotFoundException e)
       e.printStackTrace();
      finally
       if(con != null)
        try
         con.close();
        catch (SQLException e)
         e.printStackTrace();
      DBTableModel model = new DBTableModel(crs);
      table = new JTable(model);
      JPanel center = new JPanel();
      center.setLayout(new BorderLayout());
      center.add(new JScrollPane(table), BorderLayout.CENTER);
      add(center, BorderLayout.CENTER);
      table.addMouseMotionListener(new MouseMotionAdapter()
       public void mouseMoved(MouseEvent me)
        int col = table.columnAtPoint(new Point(me.getX(), me.getY()));
        int row = table.rowAtPoint(new Point(me.getX(), me.getY()));
        if(col == 2)
         Object val = table.getValueAt(row, col);
         boolean isSelect = table.isCellSelected(row, col);
         boolean focus = table.isCellSelected(row, col);
         TableCellRenderer cellRender = table.getCellRenderer(row, col);
         Component comp = cellRender.getTableCellRendererComponent(table, val, isSelect, focus, row, col);
         comp.setCursor(new Cursor(Cursor.HAND_CURSOR));
         comp.setBackground(Color.yellow);
    private JTable table;
    class DBTableModel extends AbstractTableModel
    ResultSet rs;
    ResultSetMetaData rsMeta;
    DBTableModel(ResultSet rs)
      try
       this.rs = rs;
       rsMeta = rs.getMetaData();
      catch(SQLException e)
       e.printStackTrace();
    public int getColumnCount()
      try
       return rsMeta.getColumnCount();  
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public String getColumnName(int c)
      try
       return rsMeta.getColumnName(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public int getRowCount()
      try
       rs.last();
       return rs.getRow();
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public Object getValueAt(int r, int c)
      try
       rs.absolute(r+1);
       return rs.getObject(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public boolean isCellEditable(int r, int c)
      return false;
    public Class getColumnClass(int c)
      return getValueAt(0,c).getClass();
    }

  • Error window while changing the value in SelectOneChoice.

    Hi I am facing a problem on change of values in SelectOneChoice, "ERROR For input string: "N"
    Below is how i am implementing SelectOneChoice:
    I am creating values for SelectOneChoice in a Java class:
    *SelectItem itemY=new SelectItem();*
    *itemY.setLabel("Yes");*
    *itemY.setValue("Y");*
    *confirmation.add(itemY);*
    *SelectItem itemN=new SelectItem();*
    *itemN.setLabel("No");*
    *itemN.setValue("N");*
    *confirmation.add(itemN);*
    Using this values in JSFF like this:
    *<af:selectOneChoice value="#{bindings.confURLSubmitted.inputValue}"*
    *label="Conference Website URL Submitted"*
    *required="#{bindings.confURLSubmitted.hints.mandatory}"*
    *shortDesc="#{bindings.confURLSubmitted.hints.tooltip}"*
    *binding="#{backingBeanScope.EditComplianceDetails.confURLSubmitted}"*
    *id="confURLSubmitted"*
    *unselectedLabel="Select One"*
    *autoSubmit="true"*
    *valueChangeListener="#{backingBeanScope.EditComplianceDetails.OnConfURLSubChange}">*
    *<f:selectItems value="#{pageFlowScope.generalLists.confirmation}"*
    *binding="#{backingBeanScope.EditComplianceDetails.si1}"*
    *id="si1"/>*
    *</af:selectOneChoice>*
    And in bean method i am trying to print the selected value in SelectOneChoice:
    *public void OnConfURLSubChange(ValueChangeEvent valueChangeEvent) {*
    *// Add event code here...*
    *System.out.println("this.confURLSubmitted.getValue() "+this.confURLSubmitted.getValue());*
    Now when i try to change the value in SelectOneChoice:
    I am getting an error window "ERROR For input string: "N"
    Any idea y i am getting this error.
    Thanks in Advance

    Remove selectOneChoice value binding and set static value and try
    *<af:selectOneChoice value="XXX"*
    label="Conference Website URL Submitted"
    required="#{bindings.confURLSubmitted.hints.mandatory}"
    shortDesc="#{bindings.confURLSubmitted.hints.tooltip}"
    binding="#{backingBeanScope.EditComplianceDetails.confURLSubmitted}"
    id="confURLSubmitted"
    unselectedLabel="Select One"
    autoSubmit="true"
    valueChangeListener="#{backingBeanScope.EditComplianceDetails.OnConfURLSubChange}">
    <f:selectItems value="#{pageFlowScope.generalLists.confirmation}"
    binding="#{backingBeanScope.EditComplianceDetails.si1}"
    id="si1"/>
    </af:selectOneChoice>

  • Error trying to Change the default encoding for JVM

    I tried to change the default encoding for my JVM on a SUN but when i use the java -Dfile.encoding = ISO8859_1 command, i obtain the following error:
    Error occurred during initialization of VM
    java.lang.Error: java.io.UnsupportedEncodingException:
    Is there something wrong with my command or something that i have to take into account in order to try to change this property?
    I am using the j2sdk1.4.1_02 and now i have ISO646-US an i need to use ISO8859_1 on a Sun Solaris Box
    Thanks in Advance.

    try Dfile.encoding=ISO-8859-1
    (I saw that in http://forum.java.sun.com/thread.jsp?forum=37&thread=405778&tstart=15&trange=15)

  • Can you change the value of a variable that is reset by a parameter?

    Sorry if this is simple but I just crashed a package and can't do an autopsy. I suspect I sent it into an infinite loop. I know you can't change the value of any passed in parameters. What I tried to do was have the parameter set the value of a variable
    and then I tried to change the value of the variable. Is that even allowed?
    I was trying to do this:
    MyCheckVariable = MyParameter (which equals true)
    (some cool stuff happens)
    MyCheckVariable = False
    I hit F5 and my package turned into the Energizer Bunny. Is the way I try to reset the variable the culprit?

    This is a prototype so I just created a project parameter and set it to true. In the real world the parameter will be used to control an optional part of the process because on a re-run after error that part doesn't have to be ran again.
    So when I say MyCheckVariable = MyParameter (which equals true) in reality what I actually have is in the variables window I'm using an expression and it looks like this in the variables window
    name = runDownload
    Scope = Package
    Data Type = Boolean
    Value = True (but greyed out)
    Expression = @[$Project::param_runDownload]

  • Validation error while trying to change a value in a request scope bean

    - JBoss 4.2.3.GA
    - JSF 1.2_09-b01-BETA1 (Mojarra)
    - Java 5 Update 17
    Hello, everybody!
    I'm having the following problem in my JSF web application:
    I have a request scope backing bean. The first time this bean is loaded (I check
    this with the ResponseStateManager.isPostBack() method) I fill a list of SelectItem
    instances that are to be displayed in the JSF page in a +<h:selectOneMenu>+ component.
    The list goes, of course, to the +<h:selectOneMenu>+'s +<f:selectItems>+ facet child
    component. In the constructor I also define the value that goes to the value property
    of the +<h:selectOneMenu>+ component. This value is a property in the backing bean, as
    is the list of SelectItem instances. Until now we have something like this:
    The backing bean declaration in faces-config.xml:
    <managed-bean>
        <managed-bean-name>solicitacaoGeral</managed-bean-name>
        <managed-bean-class>br.urca.solicitacoes.web.PaginaSolicitacaoGeral</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    The relevant parts of the JSF page:
    <h:form id="form">
        <h:selectOneMenu value="#{solicitacaoGeral.setorOrigem}" id="foco">
            <f:selectItems value="#{solicitacaoGeral.setoresOrigem}" />
        </h:selectOneMenu>
    </h:form>
    The relevant parts of the backing bean class:
    public class PaginaSolicitacaoGeral
        private final List<SelectItem> fSetoresOrigem = new ArrayList<SelectItem>();
        private Setor fSetorOrigem;
        public PaginaSolicitacaoGeral()
            if (primeiraExibicao()) // First load (!ResponseStateManager.isPostBack())
                // Fill fSetoresOrigem...
                fSetorOrigem = ...
            else // Page submitted
                // Read below...
        public List<SelectItem> getSetoresOrigem()
            return fSetoresOrigem;
        public Setor getSetorOrigem()
            return fSetorOrigem;
        public void setSetorOrigem(Setor setorOrigem)
            fSetorOrigem = setorOrigem;
        private boolean primeiraExibicao()
            String idFerramentaExibicao =
                FacesContext.getCurrentInstance().getViewRoot().getRenderKitId();
            ResponseStateManager gerenciadorEstadoResposta =
                RenderKitUtils.getResponseStateManager(
                FacesContext.getCurrentInstance(), idFerramentaExibicao);
            return !gerenciadorEstadoResposta.isPostback(
                FacesContext.getCurrentInstance());
    }But when the user submits the form and the bean constructor is called again
    (this time the method ResponseStateManager.isPostBack() returns true ),
    in the else block in the constructor above, I need to fill fSetoresOrigem with
    other values and also the fSetorOrigem field because, of course, the fSetorOrigem
    field has to be a valid value that exists in the new fSetoresOrigem list.
    JSF is not complaining about the change to the list items, but it is complaining
    to the change to the fSetorOrigem field (the list value), even though it is a
    valid value present in the list. So I'm getting this error message:
    08:23:54,312 INFO  [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
    sourceId=form:foco[severity=(ERROR 2), summary=(form:foco: Validation Error: Value is not valid), detail=(form:foco: Validation Error: Value is not valid)]I suppose that JSF is comparing the new value of the field fSetorOrigem with the value
    it has in the view state. As the value is different it is raising the error. That's
    what I suppose. But am I not able the change the value in the postback? I've already
    checked and the value is valid. It corresponds to a value that exists in the list.
    I really need a solution to this problem as I'm stuck with this and can't proceed until
    I find a solution to this. What I am doing wrong and how can I solve this?
    Thank you very much.
    Marcos

    BalusC wrote:
    It is comparing the selected value against the List<SelectItem> returned by getSetoresOrigem() as it is during the apply request values phase of the form submit request.Ok. That's what I supposed JSF was doing.
    BalusC wrote:
    If the selected value isn't in there, then you will get this error.I can understand this, but is this right? As I said, the old value isn't really there because I changed the list values to new ones. But the new value (the value of fSetorOrigem ) corresponds to a value that exist in the new list items, so a valid value. So JSF is not considering that I also changed the list, not just the value. It is comparing the new value with the old list, not the new one. Acting like this JSF is making the page looks like a static HTML page, not a dynamic one. If I can't change the list and the value, what's the point of that? In my point of view I'm not doing anything wrong, I'm not violating any JSF rules.
    Marcos

  • HT5621 Trying to change the email on my apple ID but get error message that the email I want to change to is already used for notifications. What do I do?

    Hi,
    I'm trying to change email address on my Apple ID since the email registered for the account has been hacked and I can't access it anymore. The email I want to change to is connected to another Apple ID I created about 4 years ago, though I successfully changed the email on that account as well. So the email I would like to use for my main Apple ID shouldn't be "locked" anymore.
    Though, when trying to change the email on my Apple ID I get an error message (in Swedish, so this is a direct translate from google): "This e-mail address is your email address for notification. It can not be used as the Apple ID or primary email. Choose a different address."
    I'm not really sure what this means or how I can fix this. The email address is connected to my Ipad and Iphone for the email app, can that have anything to do with it?
    If it makes any difference, I updated both my Ipad3 and Iphone4 to ios 7 today. I'm trying to change from my Macbook air though.
    Please advise, would really appreciate a reply ASAP.

    caek1 wrote:
    Hi,
    I'm trying to change email address on my Apple ID since the email registered for the account has been hacked and I can't access it anymore. The email I want to change to is connected to another Apple ID I created about 4 years ago, though I successfully changed the email on that account as well. So the email I would like to use for my main Apple ID shouldn't be "locked" anymore.
    Though, when trying to change the email on my Apple ID I get an error message (in Swedish, so this is a direct translate from google): "This e-mail address is your email address for notification. It can not be used as the Apple ID or primary email. Choose a different address."
    I'm not really sure what this means or how I can fix this.
    It means exactly what it says... The email Address is in Use. You cannot re-use it.
    Apple ID Support  >  http://www.apple.com/support/appleid/

  • Error while trying to change the user password on OSX Lion

    Hello,
    I am trying to change the user password ( no admin user ) using the webinterface. I enabled the functionality in webservices on the server.
    I can loginto the three line password changing form. After I enter the old and two times the new password, I get the information
    "Your request could not be completed. The password server may be unavailable."
    How can I fix this problem?  I also tried https://discussions.apple.com/thread/2485167?start=0&tstart=0.
    Thanks in advance for help.

    I currently have this error on my 10.6.8 ML server when trying to change password.
    In my situation, the message definitely comes from the password policies. As soon as I use a new password that respects minimum complexity (e.g. 8 characters min, 1 lowercase letter, 1 uppercase letter, 1 number), the password changes flawlessly.
    It would be nice to change this horrible message to something more meaningful... If someone has any ideas on how to do this, thanks for sharing!

  • When i change the value of a combo box using a property node it displays the value not the item label

    I am using a combo box as a select list for text serial commands.  I have items like "engineering", "GUI", and "Scan" for the commands "MDE", "MDN", and MDS respectively which i have input as the corresponding value in the combo box.  so for example the label "engineering" has the value "MDE" in the combo box items list.  when the Vi starts it needs to read the current value MDE, MDN, or MDS and then i want it to display on the front panel the item text corresponding to that command value.
    To do this i have tried to read the serial command, ie MDS and then wire that to a "value" property of a property node of the combo-box, but instead of displaying the corresponding item label, "Scan", it displays the value "MDS" on the front panel instead.  i want the front panel to use the label text when choosing and displaying but the block diagram to use the serial commands.  Can this be done with a combo box?  I'm trying to use a combo box so i can keep it all text and avoid having to build a case statement to convert enums or rings from a numerical value to the text command.
    The correct text value is wired to the value property and it does exist in the combo-box.  I have unchecked "values match items" and selected to not allow undefined values.

    Don't use the value property node.  Use the Text.Text property node.  When creating the property node, select Text, then in the next pop-up box, select Text.
    - tbob
    Inventor of the WORM Global

  • Error when trying to change the Query in Bex??

    Hi Gurus,
    I have a query based on infocube. When I am trying to change the query, its giving me the error "This component was edited with a more recent version of Editor. You also have to use the more recent version to edit further. Further processing not possible. Update your front end".
    Please help with this.

    Hi, I am actually stuck here. Can you please let me know which among these is the higher version.
    1) Final Release 3.50
       Version 3500.3.016
    2) Final Release 3.50
        Version (Revision 481)
    Because it is working fine in the 1st one whereas its throwing that error pop-up in 2nd one(as soon as we select the Change query global definition option) .

  • HT4009 Hi, Getting an error while trying to download updates. Err Msg "Account Not in this store' Your account is not valis for use in the US store. You must switch store before purchasing' Have tried to change the store bu not successful. kindly advice

    Hi, Getting an error while trying to download updates. Err Msg "Account Not in this store' Your account is not valis for use in the US store. You must switch store before purchasing' Have tried to change the store bu not successful. kindly advice

    http://support.apple.com/kb/HT1311

  • HT1918 I purchased Iphone in London. Then i shifted to India after 1 yr and now i want to change the account info. But when i tried to change the credit card details in itunes, i get an error message that this card is not valid in UK.

    I purchased iphone in London one year back. Then i shifted to India recently. Now when i want to change my credit card detail in itunes, i get an error message that This card is not valid in UK. But i am no more in UK now. In the same page i edited my address but itunes does not change that details showing the above error message.

    So you are trying to change the account from India to the Uk right...? Cause it wont accept UK card if you're trying to keep it for India...

  • Trying to change the Release/Debug connection string (ORACLE) of a VS13 Lightswitch project. Getting ORA-00942 error...

    Hello,
    i try to change the connection string of a Lightswitch 2013 project. I have a database for developers and a 'productive' database for releases. Both are similar (table names, entries etc..) and they are from ORACLE. First i attached the developer database
    as an external source. Everything works fine. Now I'm trying to change the connection string  whether my application is in a release state or in a developer state.
    I found a hint in the following question to solve that issue: Question
    from a LS-User 
    It is possible to change the connection string during the runtime. I tried it out and added to my DataBaseService.lsml.cs:
    partial void DataBase_InitializingConnection(DatabaseConnectionState state)
    state.ConnectionString = "DATA SOURCE=DB.productive;PASSWORD=password;PERSIST SECURITY INFO=True;USER ID=USER_PROD";
    Well, Lightswitch is using the new connection. But when i run the application, i am getting the error "ORA-00942: table or view does not exist". The views and tables definitely exist. The two schemas are the same. So what am i doing wrong?
    Regards from Munich

    HI Munich,
    Welcome to Lightswitch forum.
    According to your description above, you want to connect to external datasource in Lightswitch application.
    Oracle is not a supported data source for LightSwitch, it's recommended to use SQL Server database.
    If you want to change the connection string, you can update the connection string for a data source using the data source wizard. For example in VS2013: 
    Please let me know if there is anything that I can do to help.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for