Expression Builder: convert string to number

Hi all,
I'm having trouble building a field validation rule for bank account numbers.
The numbers have 12 positions, so I cannot use a string or text number.
The validation rule to be implemented is that the last two digits are calculated based on the first 10 (modulo 97).
However, when I use the Mid function to pick the first characters, I am unable to do any calculations on it. Apparently, the string to number conversion doesn't work (it should work when I read the manual, as it says that when using an operator between two data types, the second type is converted to the first (cf. example of 1234+abcd (should result in 1234 as to the manual))). So I tried '1*Mid(...)' or '0+Mid(...)'. Syntactically the expression builder accepts it and I can save it. BUT when I change the particular value on the screen, it gives me an SSO error (not the Field Validation error message I entered).
Why isn't there simply a function ToNumber (like ToChar)????? How could I workaround this?
Any input very welcome!
Frederik

Apparently, I was a bit confused when typing the first sentence, it should be:
The numbers have 12 positions, so I cannot use an integer or number data type, but have to use String.

Similar Messages

  • Converting string to number

    Why the number doesn't contain the whole string and how to solve it ? 
    VI is attached
    Solved!
    Go to Solution.
    Attachments:
    String to number.vi ‏7 KB

    MarinaNashaat wrote:
    binary bits
    What does that even mean?
    Post a screenshot of your VI with the data typed in.  Or put the data in the control.  Right click and save the value as defaul.  Save the VI and attach that.
    (Please put all of your information in one post.  No need to create another message.  You can even edit your previoius message within a reasonable period of time if you go to the options menu to the right of the message and choosed Edit Reply.

  • Function to convert string to number

    Hi there,
    I wrote a function which converted a hor minute component of a date to a number. Now I need to do the same with a string (because the hours could be more then 23:95). Anyway here is my function. How can I rewrite it so it will accept a string as in parameter. Somwhow I can not work it out. Thanks a lot.
    Chris
    function calculate_hours_project(in_hours in DATE)
    RETURN number
    AS
    hrs CHAR(2);
    mins CHAR(2);
         BEGIN
              hrs := to_char(in_day, 'HH24');
              mins := to_char(in_day, 'MI');
              if hrs is not null and mins is not null then
              RETURN to_number(hrs + (mins/60));
              else
              RETURN 0;
              end if;
    END calculate_hours_project;

    Wouldn't it just be something like this?
    sql>create or replace function calculate_hours_project(in_hours in varchar2)
      2  return number
      3  is
      4  begin
      5    return to_number(substr(in_hours, 1, instr(in_hours, ':') - 1)) +
      6           to_number(substr(in_hours, instr(in_hours, ':') + 1) / 60);
      7  end calculate_hours_project;
      8  /
    Function created.
    sql>select calculate_hours_project('08:05') from dual;
    CALCULATE_HOURS_PROJECT('08:05')
                           8.0833333
    1 row selected.
    sql>select calculate_hours_project('35:34') from dual;
    CALCULATE_HOURS_PROJECT('35:34')
                           35.566667
    1 row selected.

  • Not able to convert string attribute to number and date please help me out

    not able to convert string attribute to number and date attribute. While using string to date conversion it shows result as failure.As I am reading from a text file. please help me out

    Hi,
    You need to provide an example value that's failing and the date formats in the reference data you're using. It's more than likely you don't have the correct format in your ref data.
    regards,
    Nick

  • Convert String to Date and Format the Date Expression in SSRS

    Hi,
    I have a parameter used to select a month and year  string that looks like:    jun-2013
    I can convert it to a date, but what I want to do is,  when a user selects a particular month-year  (let's say "jun-2013")
    I  populate one text box with the date the user selected , and (the challenge Im having is)  I want to populate a text box next to the first text box with the month-year  2 months ahead.    So if the user selects 
    jun-2013   textbox A will show  jun-2013 
    and textbox B will show  aug-2013..
    I have tried:
    =Format(Format(CDate(Parameters!month.Value  ),  
    "MM-YYYY"  )+ 2  )   -- But this gives an error
    This returns the month in number format   like "8"    for august...
    =Format(Format(CDate(Parameters!month.Value  ), 
    "MM"  )+ 2  )
    What is the proper syntax to give me the result    in this format =  "aug-2013"  ???
    Thanks in advance.
    MC
    M Collier

    You can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
    In your case, the code would be something like:
    var sDate = "2013-01-10";
    // Convert string to date
    var oDate = util.scand("yyyy-mm-dd", sDate);
    // Convert date to new string
    var sDate2 = util.printd("mm/dd/yyyy", oDate);
    // Set a field value
    getField("date2").value = sDate2;
    The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started.

  • How can I convert the variable expression stored as string back to variable expression

    How can I convert the variable expression stored as string back to variable expression?
    I am storing the expression enterd in the TSExpresssionEditControl as simple string and want to convert back to expression since I want to get the data type of that expression.

    pritam,
    I'm not sure what you're trying to do exactly. If you are trying to get the value of a variable and you only have the name of value in a string, then you can use Evaluate() to get its value. If you want the data type, my advise is to use the GetPropertyObject() API method and just pass in the loop up string. Then you'll have a handle to the data object and then proceed from there.
    Regards,
    Song D
    Application Engineer
    National Instrument
    Regards,
    Song Du
    Systems Software
    National Instruments R&D

  • Converting String Characters into Regular Expression Automatically?

    Hi guys.... is there any program or sample coding which is available to convert string characters into regular expression automatically when the program is run?
    Example:
    String Character Input: fnffffffffffnnnnnnnnnffffffnnfnnnnnnnnnfnnfnfnfffnfnfnfnfnfnnnnd
    When the program runs, it automatically convert into this :
    Regular Expression Output: f*d

    hey guys.... i am sorry for not providing all the information that you guys need as i was rushing off to urgent meeting... for my string characters i only have a to n.. all these characters are collected from sensors and stored inside database... from many demos i have done... i found out that every demo has different strings of characters collected and these string of characters will not match with the regular expressions that i had created due to several unwanted inputs and stuff... i have a lot of different types of plan activities and therefore a lot of regular expressions.... if i put [a-z|0-9]*... it will capture all characters but in the same time it will be showing 1 plan only.... therefore, i am finding ways to get the strings i collected and let it form into regular expression by themselves in the program so that it will appear as different plans as output with comparing with the regular expression that i had created.... is there any way to do so?
    please post again if there is any questions u are still not familiar with... thank you...

  • Fract String to Number converts "700,5" to 700,49999999

    I found that for some numbers the Fract String to Number vi creates a small rounding error. As an example “700,5” converts to 700,49999999. (Se attached image and vi). Is there a way to fix this?
    To see this error you have to adjust the number of digits to display in the Display format property tab. Or you can try using the round to nearest vi which will round to 700 and not 701. (This was how I found the error 
    I’m using Labview 2009.
    Terje
    Message Edited by Terje on 02-08-2010 05:00 AM
    Message Edited by Terje on 02-08-2010 05:01 AM
    Message Edited by Terje on 02-08-2010 05:06 AM
    Solved!
    Go to Solution.
    Attachments:
    rounding error.vi ‏6 KB

    Gerd,
    i just searched in the web a little bit in order to shed some light on the issue. Sadly, i found no real "solution", but something interesting:
    Due to Wikipedia (See in chapter "Character Representation"), the rounding for floating point numbers is correct with 17 decimal digits for binary64 values (which LV-doubles are).
    I previously found out, that the change from 770.5 to 700.4999 is done if the number of significant bits in the display option is set to something higher than 17 (so 18 or above).
    I find this is a fascinating coincidence......
    Norbert
    Message Edited by Norbert B on 02-08-2010 07:52 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Converting strings to the floating number and plotting

    Hello,
    I have a question regardting converting string of numbers to the floating bumbers and plot for voltage vs. weight.
    The load cell for the ADC resolution is 16 bits, and the voltage will be in between +-5 volts.
    The problem, I have the most is converting the string of numbers to the floating numbers, in my case is the weight.
    Attachments:
    tunnelv1.vi ‏139 KB

    When you say "string of numbers" do you mean an array? What is the specific issue you are having? You seem to have orange wires running all over the place. Give a small example demonstrating the problem.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Take the average of the measured values wich cannot be converted from string to number..

    Hello,
    I have a Keithley 182 Digital Nanometer (K182). I am usins it to measure voltage at high temperature. I want K182 to measure 3 times and then take the avarage of collected data.
    1. First problem is, as you can see from picture, string to number conversion. I tried many ways but I couldn't do it. Values as you see 0,00, and once was
    3,98E-3
    0,00
    392,0
    originan values were
    3,98E-3
    3,95E-3
    3,93E-3
    in table, values generally like this.
    2. I need to take avarege. So i need toindez data, then take avarage. So, I have also problem here...
    Could you please help on thic topic. Thanks in advance.
    Attachments:
    string-number.png ‏19 KB
    string-number-panel.png ‏30 KB

    thank you, I will try this solution. Also I want to do one more thing. So, I am collecting data and putting them in to table let say data are like this
    Temp1     Temp2   Volt
    123,3       234,5      ...
    234,4       567,7
    345,6       789,9
    456,7       678,8
    I want to put data with increment like this given below:
    No  Temp1     Temp2   Volt
    1    123,3       234,5      ...
    2    234,4       567,7    
    3    345,6       789,9
    4    456,7       678,8
    there are no exact number of data. the number of data can change from measurement to measurement (1000, 2000, 500 more or less). How can I program this increment in my system.
    My system is include LakeShore 336 temperature conroller and Keithley 182 Nanovoltmeter. I will set the temperature specified value from room temperature wtih specific ramp rate. Meanwhile I will measure the voltage from sample via K182. So, I can measure both temp, and voltage via taking help from u.

  • How to convert string to decimal in data association function?

    In a BPM Script component, how in the Data Association can I use an expression to convert an argument from String to Decimal?  I have a Process argument named percentage which is a string.  I need to set the value of a data object called signed to either "Y" or "N" based on the percentage being greater than 0.4.  Something like this:
    (percentage > 0.4) ? "Y" : "N"
    The problem here is that percentage is a string, so must be converted to a decimal value before the compare will work.  I cannot find a function that allows that.  I need something like parseDecimal(percentage), but the Expression Builder does not offer that for a string using a Simple Expression.
    If it cannot be converted, is there another way to do this?

    Guessing you figured this out on your own, but if you wanted to use a Script activity one way to do what you want is when you're creating your data associations drag the "Expression" icon in the middle and double click the icon in the middle you just added:
    Get out of the Simple expression mode and into the XPath expression mode by clicking the dropdown in the upper left corner -> click "XPath Exp".
    In the Functions dropdown on the right, click "Conversion Functions" -> click "number" and then insert it into the expression.
    In the Variables list, select your string variable and insert it into the number function so that it looks something like this:  number(bpmn:getDataObject('myStringVariable'))
    Click OK
    Click your expression icon in the middle and drag it over your decimal variable.
    To have it evaluate and return a Boolean expression in your Script activity, add a Boolean process variable and add an XPath expression as described above except have the logic be this:  number(bpmn:getDataObject('myStringVariable')) > .4  (the "greater than" shown above is added to the expression by clicking "Logical Functions" from the functions dropdown).  Click OK and drag your expression icon over your Boolean variable.
    Dan

  • Converting a hex number to binary

    How do you convert a hexadecimal number to the actual 1's and 0's of binary? I am using labview 6i. Also I will eventually need the binary to be a string. Thanks.

    Converting for numeric display is quite simple. All you do is on the control/indicator, show the radix, and set it to the desired setting.
    Setting up to display the binary in text is a bit more tricky. You need to insert a "Format Value" function in and wire "%b" to the format string. This will cause the output to change to binary.
    Good luck

  • Checking for empty tags using expression builder for XPATH

    I am creating several filters in a mediator for several parallel paths. I am trying to route the mediator to the correct DB adapter based on what tags are empty in the incoming XML. The XML has 1 required tag and 3 optional. So for the expression, I am using the expression builder to load the tag name then putting either [text()] or [not(text())] immediately after each tag with an "and" in between for the 3 optional elements. The problem I am having is they always return false. For example, if I enter a value for an optional tag and put [text()] after it, it evaluates to false. What is the correct way to check if an element has text or not?
    Thanks in advance!

    Hi,
    Its not recognizing the getVariableData func... instead try this:
    string-length(xpath)>0
    ex: string-length($in.body/imp1:manoj/imp1:C1)>0
    It works... Happy deploying ... :)

  • Object type mappings in expression builder

    Hi,
    I'm trying to use expression builder to give me a query returning all instances of an object with a particular foreign key, and where 'active' = true.
    'active' is a CHAR field in the database with values 'T' or 'F' and this is mapped to a Boolean in workbench as true and false.
    All works fine in normal operations, retrieving and writing the data.
    I've written the expression as
    myId EQUAL arg
    AND
    active EQUAL 'true'
    where 'true' is a literal of type Boolean.
    Unfortunately, running this query generates an error that no mapping exists for 'true'.
    I've also tried changing it to
    active EQUAL 'T'
    where 'T' is a literal of type String.
    This also generates an error.
    It seems to me as though the object type mapping is confusing the expression builder and it can't generate the sql correctly.
    Any ideas?

    Can you post the specific version of TopLink, the exact code you are using to construct and execute your query, as well as the error message with stack trace. With these items we should be able to provide an answer for you.
    Doug

  • Ceiling Function in Expression Builder in an Update Field Value Workflow

    I'm trying to use the "ceiling" function in an update value workflow. I want to multiple the number value in field A by the currency value in field B and have that new value display in field C. But I also want to round up or ceiling the resulting value to the nearest $0.10. Here is what I want to do, but this is not working. PLEASE HELP.
    EXPRESSION BUILDER FUNCTION
    FIELD C = CEILING((FIELDA*FIELDB)+FIELDB,0.1)
    Edited by: gprobertson on Feb 15, 2010 10:20 AM

    Hi, I dont think this function is supported in workflow expressions. It is only available in reporting / analytics. Even there it only Rounds a noninteger numerical expression to the next highest integer. Even the function round doesnt seem to be available in workflow functions list
    -- Venky CRMIT

Maybe you are looking for

  • Problem with gui_download

    Hi, in my gui_download function I'm passing the 'ASC' value to the parameter filetype but, once I go to the txt file downladed and I try to save it as a csv file I realise that it's of type UTF-8 and not an ASCII type. Can anybody tell me why the fil

  • Idvd will not burn after upgrade to maverick

    Hello- I just upgraded to maverick and now iDVD will not burn a DVD - says it does not have a compatible superdrive. It was working fine until I upgraded. How can I burn a nice DVD now?

  • Audio out of AirPlay port using apple Tv ad iPad

    If I use AirPlay to play from my iPad to my Apple TV, via the Airport Express, can I get audio out of the port on the AirPlay?

  • Add srt subtitle to itunes movie?

    Hi everyone, Is there anyway to add an external subtitle (.srt) to a movie downloaded (and playing) in itunes? Thanks,

  • Flash Animations to HD?

    Hi Folks, Hope this is the right forum... I've used flash for years and exported video for FLV viewing, but I'm stumped by a client request. I have to admit, I've only concerned myself with .mov or wmv HD output for regular video. What are the HD out