Conversion Date to integer to the string

So what I try to do is to convert the results of a query. What is happening is that my data when the month is displayed as an integer from 1 to 12. I want to convert these numbers to the string month as Jan, Feb, Mar, and so forth. I tried using the DateFormatter, but I'm guessing that this does not work because he does not like the format that comes to him in the data. It is easier to explain by looking at my code:

Here is my function to manage the date:
public void fnShowMonth(item:Object,column:DataGridColumn):String
{
Return dfShowMonth.format(item[column.dataField]);
}


Here's Date formatter:
< mx:DateFormatter id = "dfShowMonth" formatString = "MMMM" / >

Here are the data grid I use for output:
< mx:DataGrid
ID = "grid2".
dataProvider = "{cfcOutput}".
>
< mx:columns >
< mx:DataGridColumn dataField = "MONTHS TOTAL" / >
< mx:DataGridColumn dataField = "Month1" labelFunction = "fnShowMonth" / >
< mx:DataGridColumn dataField = "Year1" / >
< / mx:columns >
< / mx:DataGrid >


I used this method to other areas, but not a particular date field format. All I really want to do is convert these output numbers in a month in text in my datagrid. Right now, it gives me just an empty column "month1. I can get the numbers when I remove the labelFunction. Any ideas what I need to do?

It is rather in bad taste, but it works. You'll want to provide verification of limits

public static var months: Array = ["Jan", "Feb", "Mar", "Apr", "Peut", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "December"];

public void fnShowMonth(column:DataGridColumn):String
{
back month [column.dataField - 1];
}

Joe

Tags: Flex

Similar Questions

  • a stupid question about the string conversion error

    I learn generic

    well generic allows setting the data type that you add to the fields of the object, right?

    I made a simple example

    class generic < String >

    {

    The name of the string;

    void set (String name)

    {myIdName = name ;}

    String get() {return myIdName ;}

    }

    class using {}

    Public Shared Sub main (String [] args)

    {

    generic < String > gn = new

    (generics) < String >;

    GN. Set (90);

    System.out.println ("name entered is:" + gn.get ());

    }

    }

    now the line

    GN. Set (90);

    I know that I send a string to the value method, but I wanted to see the error that comes when I send the argument of type other than a string and sent 90 to set method (without quotes)

    the error that slammed me is

    method defined in the class generic < String > cannot be applied to the given types

    required: java.lang.String

    found: int

    reason: int real argument cannot be converted to a java.lang.String by method invocation conversion

    corresponding to a variable of type String: String extends the object declared in the class generic

    OK here is my stupid question

    I know that int cannot be converted to a string and put 90 quotes will correct the error

    What intrigued me is the last line

    "Chain extends object declared in the class generic.


    I know that everything is under the object class

    that means that means line... ??

    thnq

    What intrigued me is the last line

    "Chain extends object declared in the class generic.


    I know that everything is under the object class

    that means that means line... ??

    Which refers to the class definition you provided:

    generic class

    You "stated" in your 'generic' class a 'collar' stretching ' the object '. It reads as if it said "String declared in the class generic.

    See "Generic Types" in the Java Tutotial

    http://docs.Oracle.com/javase/tutorial/Java/generics/types.html

    Search for the word 'object' and you'll see that word highlighted in the world. Although it appears highlighted read this line:

    As you can see, all instances of the object are replaced by T. A variable of type can be any non-primitive type you specify: any type of class, any interface, any type of table or even another variable of type.

    On this page, you will see this:

    A generic class is defined with the following format:

    class name { /* ... */ }
    

    Where each one is read as: T1 extends object ', "T2 extends object", etc.

    When you said this:

    generic class

    You replaced "T1 extends object" with "String extends object".

  • Why flatten data chain not getting past all about TestStand via a local variable of the string?

    I tried to go around a series of data in TestStand as a string using "flattened chain" of LabVIEW. When I create a local variable in TestStand of type 'string' and try to write the cluster flattened at this that he simply not transmitted. If I convert the string flat binary table and then pass it around, I can recover all the data very well.

    Is there something I'm missing here?

    I've attached an example Teststand sequence that illustrates this problem. If you run this sequence that the 1st test will fail, which is the attempt to simply pass the flattened string data structure and the 2nd test will pass as it is the binary table that I generated from the flattened string.

    Thank you

    Pete

    crossrulz is correct.  The Null character affects how TestStand handles the string.  You will need to specify the string to a binary string in the list of settings both the VI.  TestStand then encodes the stringso it can prevent the loss of data.

    If you need work on the binary string in TestStand, you will need to convert it to an array of raw data with PropertyObject.GetValBinary.

  • conversion of data in series for the indicator

    I have a simple VI that I use to read data from a serial device streams.

    The data are in a three-byte code, where the first byte is an 'o' and the 2nd byte

    data and the third byte is one don't care end character.

    What I want to do is to input the value of byte 2 and use that value to set an indicator of ringtone.

    Two problems I'm having is the data looks sometimes like garbage and I'm not able

    to convert this number as Double ring indicator (button) accepts...

    Here's what I see:

    Change the button to be a U8.  Which would be more logical, since you only use a single byte.  Take your string and use the string into byte array.  You now have a table of U8.  Array index allows to get the second byte and connect it to your button.

    I would also change the channel indicator display style to be hexadecimal values.  The data will make more sense.

  • Make XY graph from the string with date and time data

    1 all sorry for my English.

    I have files with data. In this array of strings, I have 2 columns with date and time. I want to show these data to the XY Chart with time and date on some of the DBL and X on Y.

    I tried to do it by myself, but cannot add to time on X axis.

    Hi olderon,

    you date string is something like "30.01.2014" but looking for "%d//%m %y. Spot the problem?

  • Series read returns the string with excess-need information to extract data from the middle of the string

    I read data from a STI flow meter using the base series writing and reading which used the VISA.  The read string begins with 'OK' or an error code, then a carriage return, then the data follows streaming rate temp pressure flow rate comma comma comma comma Temp... and so on. The string ends with a CR LF.  I need to pull the flow, temperature and pressure data out of the string and write it to a file.  I have difficulties to find a function that will retrieve the data for the string.  Any suggestions?  Thank you.

    Try the subset of string in the palette of the chain.

    Or match the model if you want a more direct control.

    Also a good way is the string analysis, but you must be willing to read oexactly, what happens or an error, pass the entrance.

  • Compare the string to date?

    Hello everyone, I have a date recorded in this format string ' 25/05/2011' and I want to compare this string with the current date. I am able to do so if I divided the Date to a String [] string, but it's using a coding hard to compare dates, which does not work if I use: String CurDate = dateFormat.formatLocal (System.currentTimeMillis ()); Because the format is not always as DD/MM/YYYY, depending on the settings of the user's phone. I'm sure that there is a better way to compare two dates, could someone ' a please advise me on this matter. Please note that I have saved in this format DD/MM/YYYY Date String. Thanks in advance.

    create a calendar, to day/month/year and check if it's the day same long http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/util/DateTimeUtilities.html#is... )

  • Number of conversion date throws the error message.

    Hello

    I'm trying to convert a column number in a date column, but get the following error:

    SQL:

    Select to_date(INV_BALANCE_DT_WID,'dd/mm/yyyy') in the W_INVENTORY_DAILY_BAL_F;

    ERROR:

    Error at startup on line: 19 in the command.

    Select to_date(INV_BALANCE_DT_WID,'dd/mm/yyyy') from W_INVENTORY_DAILY_BAL_F

    Error report-

    SQL error: ORA-01861: literal does not match the format string

    01861 00000 - "literal does not format string.

    * Cause: Literals in the entry must be the same length as literals in

    the string format (with the exception of white space).  If the

    "FX" modifier has been switched on, the literal must match exactly.

    with no extra spaces.

    * Action: Fix format string to match the literal.

    SAMPLE DATA:

    INV_BALANCE_DT_WID - 20140101

    DESIRED OUTPUT:

    17 JUNE 15

    Could you please help me on this?

    Thanks in advance!

    The value is 20140101 then why do you use "dd/mm/yyyy '?

    SQL > SELECT TO_DATE(20140101,'YYYYMMDD')
    2 FROM TWO
    3.

    TO_DATE (2
    ---------
    1 JANUARY 14

    SQL >

    SY.

  • Problem with convert the string to date using DateTimeStringConverter

    Hello

    I would like convert string date (JJ/MM/AAAA) - it is useful to compare dates in TableColumns.

    so I use DateTimeStringConverter (the string "01/11/2014" is a value of date picker)

    DateTimeStringConverter format = new DateTimeStringConverter (Locale.FRANCE,

    "dd/MM/YYYY");

    Date d1 = format.fromString("01/11/2014");

    D1. ToString()

    "I do not get the right date, but that date =" Mon Dec 30 00:00:00 THIS 2013!

    I don't understand what the problem is (which in fact should not be a problem)?

    Any ideas?

    Thanks in advance

    Fabrice

    You have an error in the spec use format ' dd/MM/YYYY' instead of 'dd/MM/YYYY '.

    DateTimeStringConverter f = new DateTimeStringConverter(Locale.FRANCE, "dd/MM/yyyy");
    Date d1 = f.fromString("01/11/2014");
    System.out.println(d1.toString()); // --> Sat Nov 01 00:00:00 CET 2014
    

    If you do not need long, I would use DateStringConverter

  • Dial type instead of the string release date to date?

    I need to store the value of a date as a Date Picker in my table. using "as of Date" at the end of the string does not help. Anyway to make the output of date as a type selector Date?

    EvolvedDSM,

    Are you eager to store this value in a database table? If so, as the data type of the column in your table a date/time value, then the value of your date picker will be implicitly converted.

    {dateChooser.selectedDate} should work for what you do... If this does not work, provide me with some more general (non-technical) details, what you're wanting to accomplish... I'll be happy to help you further.

    Thank you
    bholli

  • SetCtrlVal on "control of the string" request execution 'int' data

    Hello

    We at KPIT Cummins use LabWindows for one of our automotive projects. We have a GUI with multiple tabs and one of our boxes of string text is emerging the error (also attached jpeg) below.

    FATAL ERROR: 'Temp.c', line 2642, col 38, id thread 0x00000F4C: invalid argument type: found "pointer to char", should "int".

    We tried to debug this project, and we believe that the line which gives us a question is:

    ret_val = SetCtrlVal (h_Tab_Intgd [INTGD_CFG_DATA_TAB], INTGDTAB_ACCXSCALE, aa_uc_Temp_Array);

    where,

    h_Tab_Intgd [INTGD_CFG_DATA_TAB] is an array of handles of the form (stores all handles to the tabs)

    INTGDTAB_ACCXSCALE is the name of the string object (exactly the name of constant as it appears in the file .h created constant LabWindows GUI)

    aa_uc_Temp_Array is an array of characters. ("0.000000\n" which currently occupies)

    There is another form in our code with similar functionality, but with a different constant ID... and the SetCtrlVal seems to work for this form. We do not understand why it gives an error of execution for this particular form.

    The code in this project is a big piece of code, and we cannot currently share the project because of a confidentiality clause. You can help us find exactly the problem with what little information shared us?

    Thanks for the snippet of code... the error was in the tab page handles... we are grateful for your help.

  • string conversion appropriate type based on the content of string

    Hello

    I have a CSV with string values, and I want to assign them to good type in labview, then assing them to some pre-existing teststand properties.

    I think a particular way in a digital chain of detection should be in labview somewhere, but I can't seem to find it.  There is certainly decimal string number and string of fractional number, but an error during their passage of a string like "blah".  They just return 0.

    So my main challenge here is to feel a digital channel, either with a single point decimal or not and the impression that it is a 'number '.

    Example:

    Takes the string->

    1.234-> is the number

    1234-> is the number

    192.168.1.12-> is not a number

    I could write a vi to do this, but I was wondering if it wasn't already obvious tool in labview, which is escaping at that time.  I don't like to reinvent the wheel, even for something so simple.

    Thank you

    David J.

    david_jenkinson wrote:

    So my main challenge here is to feel a digital channel, either with a single point decimal or not and the impression that it is a 'number '.

    Example:

    Takes the string->

    1.234-> is the number

    1234-> is the number

    192.168.1.12-> is not a number

    In the more general case, you must also be able to properly analyze, for example - 10e6, 85.83E - 3 and such good number to floating point. Also your last example is basically a number U32, just formatted in the style of IP address.

    You must use 'analysis of the string' %f format and NaN as a default value. Then also check if the string is an empty string. If this isn't the case, then it is not a number according to your narrow definition.

  • How do to convert the string (with the Hex data) in number?

    Hello

    I use TestStand 3.5 to automate a few test cases associated with boot loader.

    The requirement is that I need to read the value in some places for specific address. The values of these addresses are stored in a hexadecimal format.

    We have a step customized in TestStand through which we can read these values by address, but she returns as the type "String".

    For example, the value to 0 x 0000008 is 000001 B 2, and he returned in Locals.Value_Read as "000001 B 2" in the string.

    Is it possible, I can convert the string "000001 B 2" to a number?

    I tried to use the function-> val (locals. Value_Read), but it is return 0 as TestStand figures that the input string is not representing the valid number.

    Please help me with this.

    Thank you and best regards,

    Niraj.

    Try: Val ("0 x" + Locals.Value_Read)

  • Basic question on the string-to-number conversion

    Hello

    I have a string, for example '23,2445,45'
    I want to extract the numbers of this string and put it in an array of numbers.

    Any keyword SQL is available. What is the best way to do it.

    Thank you
    MD

    Try this

    declare
    
    type vnum is varray(20)  of number;
    
    vnum1 vnum :=vnum();
    
    j number;
    
    begin
    
    j:= 1;
       for i in (
       with t as (
       select '23,2445,45' product_string from dual
       )
       SELECT   *
           FROM (SELECT
                        RTRIM(LTRIM(SUBSTR(product_string,
                                           INSTR(',' || product_string||',', ',', 1, n),
                                             INSTR(',' || product_string||',', ',', 1, n + 1)
                                           - INSTR(',' || product_string||',', ',', 1, n))),
                              ' ,') AS prod
                   FROM t,
                        (SELECT     ROWNUM n
                               FROM DUAL
                         CONNECT BY LEVEL < 10))
         WHERE prod IS NOT NULL)
         loop
    
         vnum1.extend;
         vnum1(j):= to_number(i.prod);
    
         dbms_output.put_line(vnum1(j));
    
         j:=j+1;
    
         end loop;
    
         end;
      
    

    vnum1 vnum: = vnum (0,0,0,0,0,0,0,0,0);

    I did it because I don't know how to initialize the array. Need to read more about it.

    This will put the values in the vnum1 table.

    If you need to do something with the numbers in the string

    so you can do the following without using a table.

    declare
    begin
       for i in (
       with t as (
       select '23,2445,45' product_string from dual
       )
       SELECT   *
           FROM (SELECT
                        RTRIM(LTRIM(SUBSTR(product_string,
                                           INSTR(',' || product_string||',', ',', 1, n),
                                             INSTR(',' || product_string||',', ',', 1, n + 1)
                                           - INSTR(',' || product_string||',', ',', 1, n))),
                              ' ,') AS prod
                   FROM t,
                        (SELECT     ROWNUM n
                               FROM DUAL
                         CONNECT BY LEVEL < 10))
         WHERE prod IS NOT NULL)
         loop
    
    -----Do what ever you want with the number.
    
         dbms_output.put_line(i.prod);
    
         end loop;
         end;
      
    

    Published by: alvinder on March 11, 2009 15:18

    Discovered how to initialize the array.

  • Concatenate an integer to a string for?

    Hello

    I'm new to LabVIEW.

    For my internship, I GPIB hardware control and to take certain measures.

    I use the GPIB write VI which accepts a string for its data entry.

    The command I want to send is of the form: "apply 5, 1".

    I thought to concatenate a string ('Apply_"), an integer ('5'), a coma and space (" ", _") and the last integer ('1'), so that I can increment integers in a loop if necessary.

    However, the VI of string concatenate does not accept the whole entries.

    Also, I think I'm going hard on this topic (I thought adding integers as strings, but then I won't be able to increment them at each iteration).

    Can someone help me?

    Thank you very much

    Nicolas

    You can use the Format function in the chain.

    Ben64

Maybe you are looking for

  • Is there an add-on to check that bookmark URLS are still valid?

    I searched through modules you are looking for something that can check that a referenced site is still valid. I was moving my favorites for 'years' now and it would be good to clean and 'dead' sites would be a great place to start. Anyone know of on

  • Update BIOS Portege R100

    Hi all! I want to update the bios of my Portege R100, I downloaded this trought this site: http://EU.computers.Toshiba-Europe.com/cgi-bin/ToshibaCSG/download_bios.jsp?service=EU unzipped and started install2.exe but I receaved this error: "* [Error]

  • file transfer: How can I send all my files from my office text to my laptop please

    Hi responds to Microsoft How can I send all my files from my office text to my laptop please. Thank youJO

  • BlackBerry passport automatically bad time value

    It suddenly occurs to my phone while my phone vibrates as a result of the meeting are enabled. And I find that the date is set for 2014/10/01, 8:XX AM, although it is actually 17/02/2015, 4:XXPM. I reboot my phone and it does not work. I have to clos

  • BlackBerry Smartphones Blackberry "BOLD" sync

    How do I syncronise only calendar items and not contacts of CLA? reason is that my mobile office contacts there of all employees of the company (that I don't need). Basically I am looking for the function, where you check you need to synchronize like