How to modify data recieved from the database and displayed in a DG

Hello, it's me again with a simple question :
i've got the SQLi request who returns multiples rows.
In this row i have for example :
Reward --> 1
How to, instead of displaying  1 in the datagrid, change this value to "YES"
I follow this lead :
private function onResultStats(event:ResultEvent):void
                ServerStatsArr = new ArrayCollection(event.result.source);
                for (var i:int=0; i < ServerStatsArr.length;i++)
                    if (ServerStatsArr[i].abonnement ==  304){
                        ServerStatsArr[i].abonnement = 'Premium';
                    }else{
                        ServerStatsArr[i].abonnement = 'Non';   
                    if (ServerStatsArr[i].transparence ==  1) {
                        ServerStatsArr[i].transparence = 'Oui' ;
                    }else{
                        ServerStatsArr[i].transparence = 'Non' ;
                ServerStatsArr.refresh();
Why this method is working for abonnement when (ServerStatsArr[i].abonnement ==  304) it displays Premium but it's NOT working for transparence ?
i tested (ServerStatsArr[i].transparence ==  1) and (ServerStatsArr[i].transparence ==  '1')
Thank you

hi Again,
private function setLabel(item:Object,column:DataGridColumn):String
switch(column.dataField)
case "transparence":
if (item.transparence == "1")
return ("yes")
else
return ("no")
break;
case "abonnement":
if (item.abonnement == "304")
return ("premium")
else
return ("none")
break;
default:
return("");
and the adjustments to your grid - add the labelfunction to the following columns
<mx:DataGridColumn headerText="transparence" dataField="transparence" labelFunction="setLabel"/>
<mx:DataGridColumn headerText="abonnement" dataField="abonnement" labelFunction="setLabel" />
I hope we get a distinction credit for this assignment ...
David.

Similar Messages

  • Loading an Image from the database and display it on browser

    I do not know if this is even possible.
    At the moment, to load an image inside an Html page you need to use the <img src=""> tag. and in the src you put the path of the image. Now I would like to save an image inside the database.
    An option to still display the image on the browser would be that my service object, would load the object from the database (saved as blob) then save it somewhere on the Server, and the still use the <img> tag to load the image from that location.
    However I was wondering wheather there is another way to do it without saving this image on the server. that is loading the bytes from the database (or a location on the server) and provided these bytes to the jsp page to display the image.
    Is this possible? or?
    regards,
    sim085

    hmm ... ok .. that sounds good .. but that means that
    a servlet must exsist at all time to display the
    required image.Servlets are usually instantiated by the servlet container upon an incoming request.

  • How to retrieve characters like '£' from the database and write to xml file

    Hi ,
    I have a requirement to retrieve the data from database and write to files in XML format.
    I am able to do so successfuly by using XMLElement tag and writing to file through UTL_File package.
    All characters like <&@^ get converted properly, but when it comes to multibyte chars like '£', they are not able to get converted as it is.
    Can somebody please advise me how to go ahead.
    Regards

    Thanks odie.
    The nls_charset for my database is WE8ISO8859P1 and database version is Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi.
    The data (with pound sign) is sitting in one of the columns of the table and when i query it directly, I am able to view it properly.
    However when I use the below code to retrieve in XML format and print it to file, it gets changed. This file is also passed to one of the application GUI where this XML gets processsed and it is not visible properly.
    below id the sample abstract of code I am using.
    Declare
    l_file UTL_FILE.FILE_TYPE;
    l_clob CLOB;
    l_buffer VARCHAR2(32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    Begin
    SELECT XMLElement("case",
    XMLElement("comments",
    XMLElement("comment",
    XMLElement("comments",a.COMMENTS)
    ).getClobVal() val1 into l_clob
    FROM TO_COMMENTS a
    l_file :=
    UTL_FILE.fopen (XMLDIR,
    test.xml,
    'w',
    32767);
    LOOP
    DBMS_LOB.read (l_clob,
    l_amount,
    l_pos,
    l_buffer);
    UTL_FILE.put_line (l_file, l_buffer);
    l_pos := l_pos + l_amount;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.NEW_LINE('Reached end of file');
    END;
    The comments column given contains the character like pound.
    And once the file is generated and i see using the vi editor, the char is not viewable properly like £
    And when the same is passed to GUI application to be processed, its not viewable propely in GUI from IE as well like �.

  • How to select alternate entries from the database table

    Hi Experts,
    can u help me, how to select alternate entries from the database table.
    Thanks

    As there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
    What table do you have in mind, what data does it hold, and why do you want alternate records?
    matt

  • How to search a string from the database?

    how to search a string from the database? starting with some character

    If you're trying to do this in a SELECT, you can use the LIKE verb in your WHERE clause.
    Here's an Example
      SELECT obj_name FROM tadir
        INTO prog
        WHERE pgmid = 'R3TR'
          AND object = 'PROG'
          AND obj_name LIKE 'Z%'.
    In this case it will select every row that obj_name starts with Z. 
    If you wanted to find every row that the field obj_name contains say... 'WIN'  you use LIKE '%WIN%'.
    Edited by: Paul Chapman on Apr 22, 2008 12:32 PM

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • How message will be retrieved from the website and it send back to the mobi

    how message will be retrieved from the website and it send back to the mobile ?
    please give documents and sample code
    Message was edited by:
    kannankalli

    So as your query :
    The data will be fetched from website and it reach to
    mobileimplicates many possibilities.
    Well if u just want to view the website contents on your mobile then open the web browser in your mobile and open the desired web site, or u can use opera mini for this if your phone supports this.
    And if u want to fetch the contents of some site to your application, use GCF api.
    As a starter hope this will help u : http://www-128.ibm.com/developerworks/library/j-j2me4/#N10102

  • HT201317 My iPhone is running out of storage.  I want to delete a bunch of photos on my phone.  I have iCloud.  How do I delete photos from the iPhone and keep them on my computer?  I need to free up storage as my phone will no longer take photos.

    My iPhone is running out of storage.  I want to delete a bunch of photos on my phone.  I have iCloud.  How do I delete photos from the iPhone and keep them on my computer?  I need to free up storage as my phone will no longer take photos.

    The only way you can do that is to import them into your library first, but you may have done that already.
    The easiest way to tell is to select a photo from the photostream album in iPhoto and ctrl-click on it, if it gives you the option to import it isn't in your iPhoto library, if it offers you the option to show in library it has already been imorted.

  • Do any one knows how to add those arrows from the right and left side of the screen in the youtube widget which allows you to navigate back and forth between video clips?

    do any one knows how to add those arrows from the right and left side of the screen in the youtube widget which allows you to navigate back and forth between video clips?

    do any one knows how to add those arrows from the right and left side of the screen in the youtube widget which allows you to navigate back and forth between video clips?

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • Can I use stored procedures to improve data retrieval from the database?

    I have been requested to get multiple pieces of data from multiple tables and return the output in an array for use in a Java program.
    Eliminating multiple calls to the database. Currently, the data is retrieved from the database in multiple steps but to eliminate
    possible bottlenecks in the future, I created several complex sql statements.
    For instance,
    In the first table there are 20 columns of data. has a column named type which can have the one of these values: line, inn, or bsc
    In the second table there are 6 columns of data. has the additional data for type line
    In the third table there are 7 columns of data. has the additional data for type inn
    In the fourth table there are 2 columns of data. has data regardless of type
    etc...
    Depending on a specific column value retrieved (inn) from the first table:
    I need to collect all 20 columns in the first table and get all the columns in third table and the columns in the fourth table, etc.
    Question: How can I remove the duplicate primary key columns without specifying for each table the column names to be returned?
    I used the wildcard SELECT * because I didn't want to have to update the retrieval methods if additional columns are added to these
    secondary tables.
    example of my sql for type inn data:
    select * from first_table f, third_table s, fourth_table t
    where (f.column1='xxxx' and f.column2='xxxx') (the 'xxxx' are passed into the sql statement)
    and
    ((s.column1=f.column1 and s.column2=f.column2)
    and
    (f.column3=t.column1));
    Currently, I've duplicated the separate sqls for each valid type found in the first table (at least a dozen types). The only difference is
    the table name. Instead of the third table I use the second table, etc.
    The MAIN Question: How can I set this up to have one sql to handle each type? I want to eliminate having over a dozen duplicated sqls. Can I
    incorporate this into a stored procedure or something? If so, how? Can anyone provide sample coding?
    Your help is very much appreciated. Thank you.
    GD

    Hi, Salah.
    Use "Exec" in your query to run procedures.
    SAPbobsCOM.Recordset     oRS;
    oRS = (SAPbobsCOM.Recordset)pCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
    oRS.DoQuery ("EXEC YourStoredProcName");
    Triggers are not supported in SDK.
    Regards,
    Aleksey

  • How to have a multilanguage from the database

    Hi,
    I have an application under jdev 11g.
    I am using the locale and the bundle for the multilanguage.
    My problem is with the data from the database.(i.g. select on choice with the items dynamic from the database)
    Also if i am displaying for example the customer info in af:outputtext i want his name to be displayed in english , arabic and other according to the locale choice
    The Fusion Web guide on specifies the resource bundle issue.
    Any hints, doc or sample regarding this issue.
    Best Regards
    Emile BITAR
    Edited by: ebitar on Jun 11, 2009 8:24 AM

    Hi,
    resource bundles work for labels but not data. If you have such a requirement then you need to add this using a discriminator column when querying it. Say you maintain the display data in multiple languages, then you would have a column that holds the language. The query would then be for the language the user expects. If you have static data - in the select one choice case - you can use
    http://thepeninsulasedge.com/frank_nimphius/2007/09/05/adf-faces-localizing-selectonechoice-labels/
    Frank

  • Manupulate the data from the database and update it back

    hi. i was wondering if it is possible to manupulate the data that we get from the resuletSet and do some manupulation and and again update it back to the same row and column. i tried to do it but could not get it. eg. i want to increase the salary by 10% for all the employee in the salary table. i dont want to use the SQL statement. instead i want to use the java program to increase the salary by 10%.
    what i did was, i selected all the records in the table in the resultset and then i stored the salary one by one through the loos using rs.next() and manupulated the salary by the formula
    salary=salary + salary*10/100.
    then i want to update all the employee with this new salary. i dont know whether it is possible or not.
    i tried to have an UPDATE statement in the while loop with rs.next with the condition but the loop gets terminated once it tries to execute the UPDATE statment and doesnot give any result.
    any help or suggestion will be highly appreciated.

    Here's the general long hand way of doing it. You should also look into your JDBC driver and the use of updateable ResultSets for more effeciency.
    public class SalaryObject {
        private int rowId = 0;
        private double salary = 0.0;
        public void setRowId(int rowId) {
            this.rowId = rowId;
        public int getRowId() {
            return rowId;
        public void setSalary(double salary) {
            this.salary = salary;
        public double getSalary() {
            return salary;
    }Withing your dataccess class:
    Vector salaries = new Vector();
    ResultSet rs = statement.executeQuery("SELECT rowId, salary FROM YOUR_SALARY_TABLE)
    if (rs != null) {
        while(rs.next()) {
            SalaryObject salaryObject = new SalaryObject();
            salaryObject.setRowId(rs.getInt("rowId"));
            double newSalary = rs.getDouble("salary");
            newSalary += newSalary*10/100;
            salaryObject.setSalary(newSalary);
            salaries.add(salaryObject);
        Iterator iter = salaries.iterator();
        while(iter.hasNaxt()) {
            SalaryObject salaryObject = (SalaryObject) iter.next();
            updateSalary(salaryObject.getRowId, salaryObject.getSalary);
        public int updateSalary(int rowId, double newSalary) {
            Connection con = new java.sql.Connection();
            String sql = "UPDATE YOUR_SALARY_TABLE SET salary = ? WHERE rowId = ?"
            PreparedStatement pStmt = con.prepareStatement(sql);
            int success = 0;
            try {
                pStmt.setDouble(1, newSalary);
                pStmt.setInt(2, rowId);
                success = pStmt.executeUpdate();
            } catch (SQLException sqle) {
                // handle exception
            } finally {
                try {
                    if (pStmt != null) pStmt.close();
                    if (con != null) con.close();
                } catch (SQLException sqle) {}
        }

  • How to Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER in VC++ ?

    Hi,
    I have :  -  IMAQ1394 2.0.1
                  -  NI Vision 7.1
    In VB, I can Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER :
        Dim Image0 As New CWIMAQImage
        imaq1394SnapCW(sid0,Image0)
        CWIMAQViewer1.Attach Image0
    Now,How can I do this in VC++6.0?
        I tried:
                  C_CWIMAQImage m_imgViewer1;
                  m_imgViewer1 = m_CWIMAQVision1.CreateCWIMAQImage();
                  m_CWIMAQViewer1.Attach(m_imgViewer1);
                  imaq1394SnapCW(Sid,m_imgViewer1);  <--there is no "imaq1394SnapCW "function in VC++,why?
        Please help me!
        Thank you!

    For people looking back at these old posts regarding
    CWIMAQViewer - it was not made to be used in the C environments and is made
    for VB.
    Refer to the following locations for displaying images in C
    environments:
    Start»All Programs»National Instruments»Vision»Documentation
    Start»All
    Programs»National Instruments»Vision»Text Based Examples
    Make
    sure that you look at the examples and documentation that is in
    reference to the C environments not the VB environments
    Vince M
    Applications Engineer

  • How do you copy images from the internet and paste them on Microsoft Word

    I'm trying to copy images from the internet and trying to paste them on to Microsoft Word and Powerpoint for an assignment but it's not working. I tried to use copy and paste and then paste special but nothing is working. Saving the image onto documents and trying to open them on Microsoft Word still doesn't work.
    PLEASE HELP!!!
    Thank you

    Hi Lily, and welcome to Apple Discussions.
    A screenshot can capture almost anything you're viewing. Hold the command and shift keys down, then press the 4 key and release all keys. Hold down the mouse button and drag the cursor to the size/area of the image you want to capture. Release the mouse button and you've captured the image. Remember that it is the individual's responsibility to respect copyright laws.

Maybe you are looking for

  • Update a field in an access database via TestStand

    I want to read a value from a numeric field in an MS Access database, increment that value by one, and then update the database record that I got the value from with the new value. I am able to execute an Open Database step, execute a Open SQL Statem

  • "WEP, WPA"ing an Airport extreme from XP

    So unfortunatly I have not gotten a replacement for my iBook that had a bad logic board and I am wanting to WEP or WPA my airpot Extreme through XP. I have try different method to no avail. I have all the drivers from the airport since I bought it. I

  • How to pay bill using Verizon electronic gift card?

    I have a Verizon Electronic gift card that I got from the recycling program.  I was told I could use this cash to pay my bill...I can't see anywhere on the website to pay my bill using this electronic gift card.  How do I use this card to pay my bill

  • Script making text binary

    have an Automator script that is doing something funky and I was wondering if someone can tell me what I am doing wrong. What the script does, is: 1. Filters an IRC chat log so that it is broken into 3 hours (2PM, 3PM, 4PM) 2. It then combines the th

  • Quote Analysis to PO

    Hello Everyone, I have a scenario wherein there are 10 lines on a Bid Quote of which 5 have been approved from the Quote Analysis Screen. Line-by-line Shipment Approvals and not Entire Quotation Approval. Now if I open the Quote and Copy Document to