Foreach returns only the first line of a dataset object

Hello, guys.

I am having trouble with a procedure in Oracle 9.2.0.1.0.

I have a query that returns the number of lines, but whenever I try to browse by using a foreach loop, I only get the first line and then the loop is completed.

For example, here's the query:

select 
      (
        CASE
          WHEN
            TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') < DATE '2009-01-01'
          THEN DATE '2009-01-01'
          ELSE
            TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY')
          END
      ) startdate,


      (
        CASE
          WHEN
          TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') > DATE '2009-06-08'
          THEN DATE '2009-06-08'
          ELSE 
          TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY')
          END
      ) enddate
     
    FROM dual
    CONNECT by trunc(DATE '2009-06-08','dd') >= add_months(trunc(DATE '2009-01-01','dd'),level - 1)

Who shows me this output:

STARTDATEENDDATE
01/01/20092009-01-31
02/01/200928/02/2009
03/01/200931/03/2009
04/01/200930/04/2009
05/01/200931/05/2009
06/01/200906/08/2009

But whenever I run this code:

  for rec in
  (
    select 
      (
        CASE
          WHEN
            TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') < DATE '2009-01-01'
          THEN DATE '2009-01-01'
          ELSE
            TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY')
          END
      ) startdate,
      (
        CASE
          WHEN
          TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') > DATE '2009-06-08'
          THEN DATE '2009-06-08'
          ELSE 
          TO_DATE(
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' ||
            to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY')
          END
      ) enddate
     
    FROM dual
    CONNECT by trunc(DATE '2009-06-08','dd') >= add_months(trunc(DATE '2009-01-01','dd'),level - 1)    
  )
  loop
    DBMS_OUTPUT.put_line(TO_CHAR(rec.startdate, 'YYYYMMDD') || '-' || TO_CHAR(rec.enddate, 'YYYYMMDD'));
  end loop;

I get this result:

20090131 20090101

I tried debugging and I checked that the loop runs that once, and then passes the end of loop. I'm doing something wrong?

Thank you!

Best regards

Vinicius

Advertisement

Try:

for rec in

(

Select * from (select

(

CASE

WHEN

TO_DATE)

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "jj"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), "DD/MM/YYYY")< date="">

THEN DAY ' 2009-01-01'

ON THE OTHER

TO_DATE)

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "jj"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), "DD/MM/YYYY")

END

) startdate.

(

CASE

WHEN

TO_DATE)

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm') and level)-1, "dd"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), ' DD/MM/YYYY') > DATE '' 2009-06-08

THEN DAY '' 2009-06-08

ON THE OTHER

TO_DATE)

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm') and level)-1, "dd"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||

TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), "DD/MM/YYYY")

END

) enddate

OF the double

CONNECT by trunc (DATE 2009-06 - 08 ',' dd') > = add_months (trunc (DATE 2009-01 - 01 ',' dd'), level - 1)

)   )

loop

Dbms_output.put_line (TO_CHAR (rec.startdate, 'YYYYMMDD') |) '-' || To_char (rec.enddate, 'YYYYMMDD'));

end loop;

SY.

Tags: Database

Similar Questions

  • Discover with function as datasource returns only the first line.

    Hello

    I created the following function to get the status of all the rules for the instances of SQL Server.

    The data type of the function output has been configured as 'List of SQLInstanceRuleStatuss', where SQLInstanceRuleStatuss is the custom type, I created in the same module.

    When I tested the function, it returns all instances of SQL Server with two other columns.

    But when I try to create a view with the Rows property that is configured to use the feature, it returns only the first line:

    sqlRules = new ArrayList();

    queryStatement = server. QueryService.createStatement ("(DBSS_Instance)");

    queryResult = server. QueryService.executeStatement (queryStatement);

    for (it in queryResult.topologyObjects)

    {

    sqlRule is functionHelper.createDataObject ("westjet_mark_dev:SQLInstanceRuleStatus", "none", "test");.

    sqlRule.instance = it;

    sqlRule.ruleName = 'test rule name';

    sqlRule.status = false;

    sqlRules.add (sqlRule);

    }

    Return sqlRules;

    Did I miss something?

    Thank you

    Mark

    Mark,

    I think I forgot something

    sqlRule=functionHelper.createDataObject("westjet_mark_dev:SQLInstanceRuleStatus","none","test");

    you create the test id

    change your line of

    sqlRule=functionHelper.createDataObject("westjet_mark_dev:SQLInstanceRuleStatus","none",null);

    This should allow the creation of a single object in your loop for

  • Mr President, how can I enter two rows at the same time with different default values that only the first line to use see?

    Mr President.

    My worm jdev is 12.2.1

    How to enter two rows at the same time with different default values that only the first line to use see?

    Suppose I have a table with four fields as below

    "DEBIT" VARCHAR2(7) , 
      "DRNAME" VARCHAR2(50),
      "CREDIT" VARCHAR2(7) , 
      "CRNAME" VARCHAR2(50),
    

    Now I want that when I click on a button (create an insert) to create the first line with the default values below

    firstrow.png

    So if I click on the button and then validate the second row with different values is also inserted on commit.

    The value of the second row are like the picture below

    tworows.png

    But the second row should be invisible. It could be achieved by adding vc in the vo.

    The difficult part in my question is therefore, to add the second row with the new default values.

    Because I already added default values in the first row.

    Now how to add second time default values.

    Concerning

    Mr President

    I change the code given by expensive Sameh Nassar and get my results.

    Thanks once again dear Sameh Nassar .

    My code to get my goal is

    First line of code is

        protected void doDML(int operation, TransactionEvent e) {    
    
            if(operation != DML_DELETE)
                 {
                     setAmount(getPurqty().multiply(getUnitpurprice()));
                 } 
    
            if (operation == DML_INSERT )
                       {
                               System.out.println("I am in Insert with vid= " + getVid());
                           insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE",
                            (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                           }
    
            if(operation == DML_UPDATE)
                              {                                                    
    
                                 System.out.println("I am in Update with vid= " + getVid());
                             updateSecondRowInDatabase(getVid(),
                                 (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                              }                      
    
            super.doDML(operation, e);
        }
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " +
                 "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')";  
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }
                  }  
    
                  private void updateSecondRowInDatabase(Object value1, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "update vdet set  AMOUNT='"+ value5+"' where VID='" + value1 + "'";                     
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
    
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }                  
    
                  }
    

    Second line code is inside a bean method

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");
                   RowSetIterator rsi = dciter.getRowSetIterator();
                   Row lastRow = rsi.last();
                   int lastRowIndex = rsi.getRangeIndexOf(lastRow);
                   Row newRow = rsi.createRow();
                   newRow.setNewRowState(Row.STATUS_NEW);
                   rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);
                   rsi.setCurrentRow(newRow);
    
                   BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");
                   RowSetIterator rsi1 = dciter1.getRowSetIterator();
                   Row lastRow1 = rsi1.last();
                   int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);
                   Row newRow1 = rsi1.createRow();
                   newRow1.setNewRowState(Row.STATUS_NEW);
                   rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);
                   rsi1.setCurrentRow(newRow1);
        }
    

    And final saveUpdate method is

        public void saveUpdateButton(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry();      
    
                   OperationBinding commit = bindingsBC.getOperationBinding("Commit");
                   commit.execute(); 
    
            OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit");
            operationBinding.execute();
            DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef.
            iter.getViewObject().executeQuery();  
    
        }
    

    Thanks for all the cooperation to obtain the desired results.

    Concerning

  • sent letter drafts in hotmail, went back to send and only the first line of the text was visible, have been if the rest went, and how do I get that back

    typed a letter and drafts in hotmail, whent sent to retrieve to send and only got the first line of text back.

    Hotmail forums:

    http://www.windowslivehelp.com/forums.aspx?ProductID=1

    They will help you when repost you your question in the Forums above for Hotmail.

    See you soon

    Mick Murphy - Microsoft partner

  • Can I use automatically select only the first line of a legend to include in the list of Figures?

    Is there a setting in the FAKE ID CS6 utility that will allow me to use only the first sentence in a legend to include in a list of numbers?

    Example of

    Willard Wharf, Cocoa, Florida, 1887.   It was the first blah blah blah of cocoa.  Photo by a dead guy.  with the permission of a lovely old lady whose grandmother collected it.

    In the example above, the whole passage is currently formatted with a paragraph style sheet in the Arno Pro Caption.  When I'm done, I would like to have this first phrase or sentence in "BOLD", which I planned to do with a character style sheet.  The rest will be normal.

    Now I understand more how the TOC utility works, I wonder, can I do a paragraph for the sentence of the title style and a second paragraph style for the remaining text in the legend that follows in the affirmative, how to make sure that the second paragraph will follow on the same line where ever the first paragraph style ends?  Nested styles, perhaps?  If the nested styles are the way to go, any comments or pointers to the simplest strategy to do this work will be appreciated.

    Legends do not match.  Some have a name and date; others are a title phrase or sentence, follow, sometimes up to several sentences.  In General, however, there is only one sentence after the title. I also usually a "courtesy of...". "statement recognizing the source of the photo.

    I'm a newbie using id cs6, for the first time, to format a book.  I'm enjoying using the program, but some details lead me sometimes at a stop.

    Thank you

    Roy

    If the TOC utility will choose paragraph or character style?

    If so, I'm good.  But the instructions in the site of Adobe and 2 manuals that I speak using paragraph styles.  The ones of my choice list.  Will have to do an essay on character styles.

  • Get only the first line of duplicate data

    Hello

    I have the following situation...
    I have a table called employees with column (object, name, function) where "re" is the primary key.

    I import data within this table using an xml file, the problem is that some employees may be repeated inside this xml file, which means, I'll have repeated "re", and presents the columns is a primary key of my table.

    To work around this problem, I created a table called employees_tmp that has the same built as employees, but without the primary key constraint, on this way I can import the XML inside the employees_tmp table.

    What I need now is to copy that data employees_tmp used, but for cases where the "re" is taken, I just want to copy the first line found.

    Just an example:

    EMPLOYEES_TMP
    ---------------------
    RE FUNCTION NAME
    ANALYST GABRIEL 0987
    MANAGER GABRIEL 0987
    RANIERI ANALYST 0978
    VICE PRESIDENT RICHARD 0875


    I want to copy the data to employees looks like

    EMPLOYEES
    ---------------------
    RE FUNCTION NAME
    ANALYST GABRIEL 0987
    RANIERI ANALYST 0978
    VICE PRESIDENT RICHARD 0875

    How would I do that?

    I really appreciate any help.

    Thank you

    Try,

    SELECT re, NAME, FUNCTION
      FROM (SELECT re,
                   NAME,
                   FUNCTION,
                   ROW_NUMBER () OVER (PARTITION BY re ORDER BY NAME) rn
              FROM employees_tmp)
     WHERE rn = 1
    

    G.

  • save after focus leaves cell saves only the first line

    I want that every cell in a table to save when focus leaves the cell. It seems that any line I am on it will always save this value in the first row. After that, I think it seems to save the new value in the correct lines. How can ensure me that the relevant line is saving?

    This is the code for my laptop...
    < af:inputText value = "#{rank." Simple PublishedNotes}' = 'true '.
    required = "#{bindings." CIsForRR.attrDefs.Notes.mandatory}.
    columns = "#{bindings." CIsForRR.attrHints.Notes.displayWidth}.
    Binding = "#{bindings_app_ci_RR.inputText5} '"
    ID = "inputText5" lines = '10' autoSubmit = 'true '.
    valueChangeListener = "#{bindings_app_ci_RR.save_notes_action} '"

    Then my save_notes_action looks like this...
    {} public void save_notes_action (ValueChangeEvent vce)
    FacesContext ctx = FacesContext.getCurrentInstance ();
    Bind ValueBinding = ctx.getApplication ().createvalueBinding("#{data}");
    BindingContext, bc = bind.getValue (ctx) (BindingContext);
    DC DCDataControl = bc.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl) dc.getDataProvider ();

    ViewObject vo = am.findViewObject ("RR");
    Line = vo.getCurrentRow ();
    prints the value of vce and the attribute of the current name of the lines
    String newVal = valueChangeEvent.getNewValue (m:System.NET.SocketAddress.ToString ());
    row.setAttribute ("Notes", newVal);
    am.getTransaction () .commit ();
    Refresh();
    }

    My impressions always printed the first line of name.

    Any help is appreciated! Thank you!

    That's because you manually make the change in your code:
    String newVal = valueChangeEvent.getNewValue (m:System.NET.SocketAddress.ToString ());
    row.setAttribute ("Notes", newVal);
    am.getTransaction () .commit ();

    Why not use a table can be changed with the binding of the ADF and simply let ADF do all the work for you.

  • My indicator shows only the first line of the string

    Hi all

    I'm having some trouble with chains, could you help me?

    I use a device connected to my computer in a RS-232 port.

    I configured the VISA series correctly. When I write a command to my device, the answer is something like this:

    "XXXXX."

    YYYYYY

    2222

    44444

    WWWW.

    The problem is when I try to read this response. The channel indicator shows only one line at a time every single loop. And the other orders received are stored in the buffer until their time to be displayed to come. I mean:

    In the first loop device XXXXX responses.

    In the second loop the device responds YYYYYY but now I stored what must appear:

    2222

    44444

    WWWW

    XXXXX

    YYYYYY

    2222

    44444

    WWWW

    In the third loop, the device responds 2222 and stores again:

    44444

    WWWW

    XXXXX

    YYYYYY

    2222

    44444

    WWWW

    XXXXX

    YYYYYY

    2222

    44444

    WWWW

    How can I configure my blocks to display the full string?

    Thank you

    Murilo

    Post your code and we can better understand what is happening.

    My first is however you spend only the corrent, reading of the indicator.

    You use a chain shift reg with a knot to concatenate a String?

    Your zip code and we'll have a glance.

  • Quick query return only the first rank wo any Where clause.

    Hey all,.

    first I apologise for this announcement, if it has already been asked some time ago, but unfortunately research forum does not at least with my IE - Setup (configured to accept cookies by the beautiful admin of our society :). After getting the results of the search by clicking an entry returns the following error:
    ---
    ERROR
    The requested URL could not be found
    The following error was encountered:
    Invalid query: malformed request
    Some aspects of the HTTP request is not valid.
    ---
    I think that that, even with secure settings, a forum should be able to work... Maybe someone would like to investingate here, but this ist NOT my Question!

    ~~~
    Problem:

    When I execute
    _ Select * from - damncomplexexpressionwithleftjoinsandwhatever - where ID1 = 5
    the query is very effective-index and takes < 1 second to execute that ok ist for the size of the Tables (~ 500 MB). So far so good.

    -> NOW I need the fastest 1-line out of this query result. But when I do
    _ Select * from - damncomplexexpressionwithleftjoinsandwhatever - where ROWNUM < 2
    It takes about 15 seconds to run, what ist too long! Unfortunately I do not have the values to put in it, so I'm looking for the fastest way without any other conditions.

    The result is not ordered, or grouped by--> so why doesn't Oracle just choose the first row it gets and runs in 0.1 sec?
    Does anyone has an idea how to solve this problem?

    Many thanks for any help! Daniel

    Little entered, cannot send you an explain plan, or trace/tkprof output?

    But perhaps you could the / * + FIRST_ROWS * / Tip:

    select /*+ FIRST_ROWS */  * from -damncomplexexpressionwithleftjoinsandwhatever- where ROWNUM<2
    
  • HttpService returning only the first result

    I have a http service and returns a result the first time, she is sent to retrieve the data from the php file.

    However, after each new. send(); brings back the same data even if the php file sends new data.

    I even use lastResult in Manager.

    < mx:HTTPService

    " url ="http://www.someaddress.com/php/abca/filldates.php"" "

    id = "testfilldates".

    useProxy = "false".

    showBusyCursor = "true".

    result = "testResults (event); »

    method = "POST" >

    < / mx:HTTPService >

    It's a browser problem capture calls to your httpservice, read this

    2901 http://www.Adobe.com/cfusion/CommunityEngine/index.cfm?event=showDetails&loc=en_US&PostID= & productId = 2

  • Scan of a file only works on the first line

    Hello

    I'm new to Labview (see 8.6) and I'm running on this problem.

    I use the Scan of a file to get a certain amount of information for the installation of test.txt.  The data of the file looks like this:

    AAA 1

    BBB 2

    REC 3

    I noticed that the Scan of the file works for only the first line.  Trying to get data that are not in the first line results in an error 85.

    Any ideas? Thank you

    It's all in what the scan of the file reads, and what is the next cgaracter in the file.

    Your first analysis of the file reads up to but NOT including the first newline in the file.

    The second read readings where the first reading was arrested and is expected to see 'B' as the next character, but sees the new line instead, and if the analysis fails. You must specify second reading formatted to await the return line.

    You can do this by making the FIRST character of the format string space, that will tell it to expect a number any of charaters 'white space '.

    Yo can indeed put a space at the beginning of the format string in your first analysis of the file and it will match with zero white space characters before you see the AAA. By doing this he also tolerate to see the spaces and tabs before your AAA or BBB identifiers.

    Rod.

  • ListField: RENDERER updates only the top line

    Hey all,.

    Calling for first time, long time listener. I cut my teeth on BB dev and have hit a snag. I created a ListField which takes an array of custom RowObjects that includes not only the table that makes up the line, but both the properties of style (background color, text color).

    My 2 questions are the only the first line is its background color and the rest are by default. None get the color of the text. It seems that the rendering engine is only called once, bouncing absolutely me.

    The second problem is that I can't scroll horizontally to view additional columns that are off-screen.

    Main components TableField code:

    package com.keslabs.kui;
    
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    
    public class TableField extends ListField
    {
        private TableRowManager[] _rows;
        private int[] _columnWidths;
        private int[] _horizontalPaddings;
    
        public TableField(TableRowObject[] contents, int[] columnWidths, int[] horizontalPaddings)
        {
            int numRows = contents.length;
    
            _rows = new TableRowManager[numRows];
            for (int curRow = 0;  curRow < numRows;  curRow++) {
                _rows[curRow] = new TableRowManager(contents[curRow]);
            }
    
            // Store the layout data.
            _columnWidths = columnWidths;
            _horizontalPaddings = horizontalPaddings;
    
            // Configure this ListField to operate with TableListField semantics.
            setSize(numRows);
            setCallback(RENDERER);
        }
    
        // Calculates the horizontal position at which the indicated
        // column should begin, based on the column widths and paddings.
        private int getColumnStart(int col)
        {
            int columnStart = 0;
            for (int i = 0;  i < col;  i++) {
                columnStart += _columnWidths[i];
                columnStart += _horizontalPaddings[i];
            }
            return columnStart;
        }
    
        public int moveFocus(int amount, int status, int time)
        {
            invalidate(getSelectedIndex());
            return super.moveFocus(amount, status, time);
        }
    
        // Invoked when this field receives the focus.
        public void onFocus(int direction)
        {
            super.onFocus(direction);
            invalidate();
        }
    
        // Invoked when a field loses the focus.
        public void onUnfocus()
        {
            super.onUnfocus();
            invalidate();
        }    
    
        // Manager that lays out the fields of a table row horizontally,
        // within the columns of its enclosing TableListField.
        private class TableRowManager extends Manager
        {
            private TableRowObject _row;
    
            // styles
            public int bgcolor = Color.BEIGE;
            public int fgcolor = Color.BLUE;
    
            // Constructor.  The elements of rowContents are added to this manager
            // so that when it is layed out, these fields become cells within a row.
    
            public TableRowManager(TableRowObject rowContents)
            {
                super(0);
    
                if (rowContents.bgcolor != -1) {
                    bgcolor = rowContents.bgcolor;
                }
                if (rowContents.fgcolor != -1) {
                    fgcolor = rowContents.fgcolor;
                }
                _row = rowContents;
    
                for (int col = 0;  col < rowContents.data.length;  col++) {
                    add(rowContents.data[col]);
                }
            }
    
            // Causes the fields within this row manager to be layed out then
            // painted.
            public void drawRow(ListField listField, int index, Graphics g, int x, int y, int width, int height)
            {
                // Arrange the cell fields within this row manager.
                layout(width, height);
    
                // Place this row manager within its enclosing list.
                setPosition(x, y);
    
                // Apply a translating/clipping transformation to the graphics
                // context so that this row paints in the right area.
                g.pushRegion(getExtent());
    
                // Paint this manager's controlled fields.
                subpaint(g);
    
                g.setColor(bgcolor);
                g.fillRect(0, y, width, height);
                g.setColor(fgcolor);
                //g.drawText("i-"+index, 0, y);
    
                listField.invalidate(index);
    
                // Restore the graphics context.
                g.popContext();
            }
    
            protected void sublayout(int width, int height)
            {
                for (int col = 0; col < getFieldCount(); col++) {
                    Field curCellField = getField(col);
                    layoutChild(curCellField, _columnWidths[col], getPreferredHeight());
                    setPositionChild(curCellField, getColumnStart(col), 0);
                }
    
                setExtent(getPreferredWidth(), getPreferredHeight());
            }
    
            public int getPreferredWidth()
            {
                return RENDERER.getPreferredWidth(TableField.this);
            }
    
            public int getPreferredHeight()
            {
                return getRowHeight();
            }
        }
    
        private static final ListFieldCallback RENDERER = new ListFieldCallback()
        {
            public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
            {
                TableField tableField = (TableField) listField;
                TableRowManager rowManager = tableField._rows[index];
                rowManager.drawRow(listField, index, graphics, 0, y, width, tableField.getRowHeight());
            }
    
            public int getPreferredWidth(ListField listField)
            {
                TableField tableField = (TableField) listField;
                int numColumns = tableField._columnWidths.length;
                return tableField.getColumnStart(numColumns);
            }
    
            public Object get(ListField listField, int index)
            {
                TableField tableField = (TableField) listField;
                return tableField._rows[index];
            }
    
            // prefix searching is not supported
            public int indexOfList(ListField listField, String prefix, int start)
            {
                return -1;
            }
        };
    }
    

    Class TableRowObject (which works fine, but I posted for ease of understanding):

    package com.keslabs.kui;
    
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    
    public class TableRowObject {
    
        public Field[] data;
        public int bgcolor = -1;
        public int fgcolor = -1;
    
        public TableRowObject(Field[] rowContent) {
            data = rowContent;
        }
    }
    

    Any help that could be provided would be great that I was stuck with this for 3 days banging my head against a wall.

    Yes, but it must not necessarily be 'this '. It can be any other object that you did in your implementation.

  • Select the first line of the annotations in a vm

    Hello

    I want to extract only the first line of the note annotations of a vm.

    I tried WAT

    $vm = get - vm host1

    $vm.description | Select - 1 first

    But I continue to receive the full description, which looks like this

    Microsoft exchange server

    support: 24 x 7

    OTAP: Production

    Status: In Production

    Try something like this

    $vm = get-vm windows1$vm.description -split '["\n\r"|"\r\n"|\n|\r]' | select -First 1
    
  • Truncate the text after the first line in TextFlow

    I have a TextFlow object that is rendered in a Sprite with several lines.

    For a compact display, I now want to show only the first line, followed by 3 dots (...).

    I've not found a good approach up to now.

    There is a support for truncation.  It is limited to cases of use of label and requires the use of the TextLine factories.  There is no support for text editable with truncation.   Example below.

    Hope that helps,

    Richard

    /**
    ADOBE SYSTEMS INCORPORATED
    Copyright 2011 Adobe Systems Incorporated
    All Rights Reserved.

    NOTICE:  Adobe permits you to use, modify, and distribute this file
    in accordance with the terms of the Adobe license agreement
    accompanying it.  If you have received this file from a source
    other than Adobe, then your use, modification, or distribution
    of it requires the prior written permission of Adobe.
    */
    package
    {
        import flash.display.DisplayObject;
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.geom.Rectangle;
        import flash.text.StyleSheet;
        import flash.utils.ByteArray;
       
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.conversion.TextConverter;
        import flashx.textLayout.elements.TextFlow;
        import flashx.textLayout.formats.TextLayoutFormat;
        import flashx.textLayout.factory.StringTextLineFactory;
        import flashx.textLayout.factory.TextFlowTextLineFactory;
        import flashx.textLayout.factory.TruncationOptions;
       
        [SWF(width="500", height="500")]
        public class Truncation extends Sprite
        {
           
            public function Truncation()
            {
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
               
                // sample of truncation with the StringFactory
                var stringFactory:StringTextLineFactory = new StringTextLineFactory();
                var stringSprite:Sprite = new Sprite();
                stringSprite.x = 25; stringSprite.y = 25; addChild(stringSprite);
                // this bounds has no maximum height
                stringFactory.compositionBounds = new Rectangle(0,0,200,NaN);
                stringFactory.text = "This is an extremely long and overly verbose string of text that I would like to see trunctated.";
                // truncate after two lines
                stringFactory.truncationOptions = new TruncationOptions(TruncationOptions.HORIZONTAL_ELLIPSIS,2);
                stringFactory.createTextLines(function (obj:DisplayObject):void { stringSprite.addChild(obj); });
               
                // sample of truncation with the TextFlowTextLineFactory
                var flowFactory:TextFlowTextLineFactory = new TextFlowTextLineFactory();
                var flowSprite:Sprite = new Sprite();
                flowSprite.x = 25; flowSprite.y = 75; addChild(flowSprite);
                // this bounds has no maximum height
                flowFactory.compositionBounds = new Rectangle(0,0,200,NaN);
                // truncate after three lines with a big red ellipsis
                flowFactory.truncationOptions = new TruncationOptions(TruncationOptions.HORIZONTAL_ELLIPSIS,3,TextLayoutFormat.createTextLayoutFormat({ fontSize:24, lineHeight:0, color:0xff0000 }));
                flowFactory.createTextLines(function (obj:DisplayObject):void { flowSprite.addChild(obj); },TextConverter.importToFlow(Data.markup, TextConverter.TEXT_LAYOUT_FORMAT));
            }
        }
    }
    class Data
    {
        public static const markup:String = "" +
            "

    The following excerpt is from Ethan Brand by Nathaniel Hawthorne.

    " +
            "

    There are many such lime-kilns in that tract of country, for the purpose of burning the white marble which composes" +
            " a large part of the substance of the hills. Some of them, built years ago, and long deserted, with weeds growing in the vacant round of the interior, which is open to the sky," +
            " and grass and wild-flowers rooting themselves into the chinks of the stones, look already like relics of antiquity, and may yet be overspread with the lichens of centuries to come." +
            " Others, where the lime-burner still feeds his daily and nightlong fire, afford points of interest to the wanderer among the hills, who seats himself on a log of wood or a fragment " +
            "of marble, to hold a chat with the solitary man. It is a lonesome, and, when the character is inclined to thought, may be an intensely thoughtful occupation; as it proved in the case " +
            "of Ethan Brand, who had mused to such strange purpose, in days gone by, while the fire in this very kiln was burning.

    The man who now watched the fire was of a " +
            "different order, and troubled himself with no thoughts save the very few that were requisite to his business. At frequent intervals, he flung back the clashing weight of the iron door, " +
            "and, turning his face from the insufferable glare, thrust in huge logs of oak, or stirred the immense brands with a long pole. Within the furnace were seen the curling and riotous flames, " +
            "and the burning marble, almost molten with the intensity of heat; while without, the reflection of the fire quivered on the dark intricacy of the surrounding forest, and showed in the " +
            "foreground a bright and ruddy little picture of the hut, the spring beside its door, the athletic and coal-begrimed figure of the lime-burner, and the half-frightened child, shrinking " +
            "into the protection of his father's shadow. And when again the iron door was closed, then reappeared the tender light of the half-full moon, which vainly strove to trace out the " +
            "indistinct shapes of the neighboring mountains; and, in the upper sky, there was a flitting congregation of clouds, still faintly tinged with the rosy sunset, though thus far down " +
            "into the valley the sunshine had vanished long and long ago.

    ";
    }

  • How can I configure only the first row of a DataGrid as the selected line?

    I have a "Go" button on a search form that retrieves data in a grid, already linked to data.  After the data is read, I want to make the first line in the Datagrid control in the selected row, as if the user has clicked on it.  If the result set is empty, I don't want the code down.  (I want only one line can be selected at a time)

    protected function btnGo_clickHandler(event:MouseEvent):void
    {
    getSBJsResult.token = baa_data_svc.getSBJs (cmbSrch.text);

    grdSBJs. //  ?????  What is happening here to select the first line?
    }

    That should do it.

    If this post has answered your question or helped, please mark it as such.

    If (myDataGrid.dataProvider.length > 0) {}

    myDataGrid.selectedIndex = 0;

    }

Maybe you are looking for

  • Can't hear sound using LifeCam HD-300

    You just bought a Web of Microsoft LifeCam HD-3000 camera.  The video works fine, but can not get any audio when skyping.  Settings shows a quality sound reading entered but no sound output through my external speakers.  Help please.  Thank you... TJ

  • Ringtone for group

    Hello how can I do a different ringtone for a contact group

  • Help, I can't buy Creative Cloud.

    I do all the steps but when I want to confirm, he puts just updated the page and I see "confirm". What I am doing wrong? I come from Germany and you want to pay with paypal.

  • Anti-aliasing does not work in Illustrator CC 2015.

    I use the latest Illustrator CC 2015 and smoothing function doesn't seem to work. All of my vector graphics are very irregular, even when I turn on the option to work smoothing in general preferences. Is this a bug or am I missing something?

  • PDF text 2 outputs?

    I'm looking for a workflow solution where it took out of 2 PDF files, production and proof.Basically, it's a pain in the hoop to create 2 files pdf every time.I'm looking for is a way through the script to export in PDF formatChooses currently open P