Retrieving values entered in a JTable

Hi!
I have made a sudoku solver as many others, but in the purpose of learning recursion, and now I am implementing GUI to that program. I have bean strugling to set up a table that shows the sudokutable, and most of all how to recieve the values entered into the table. I have looked at forums and search at google, but all the topics on this is not good enough. I just simply do not understand what they mean. Most often they just say: "Just paste this code in and it will turn out as intended". I want to know how it works.
I have added the code below:
import javax.swing.*;
import javax.imageio.*;
import java.awt.*;
import java.awt.event.*;
import easyIO.*;
import java.util.*;
import java.io.*;
* Klassen Oblig3 som inneholder main metoden som starter programmet.
* Dette er Utsynen for programmet.
* @Param ru - Peker til klassen Rute.
* @Param br - Peker til klassen Brett.
* @Param skrivebord - En ny desktpoPane som representerer hovedvinduet..
public class Oblig3 extends JFrame implements ActionListener {
     Rute  ru   = new Rute();
     Brett br   = new Brett(ru);
     ImageIcon icon;
     Image image;
     JDesktopPane skrivebord;
      * Konstrukt�ren Oblig3 som setter opp hovedvinduet.
      * @Param skjemrStorelse - Lagrer st�relsen p� skjermen.
     public Oblig3() {
          super("Oblig3");
          int innrykk = 400;
          Dimension skjermStorelse = Toolkit.getDefaultToolkit().getScreenSize();
          setBounds(innrykk, innrykk, skjermStorelse.width  - innrykk*3, skjermStorelse.height - innrykk*2);
          skrivebord = new JDesktopPane()
               Image im = (new ImageIcon("bilder/panzer.gif")).getImage();
               public void paintComponent(Graphics g){
                    g.drawImage(im,0,0,this);
          setContentPane(skrivebord);
          setJMenuBar(lagMenyList());
          skrivebord.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
     } // Slutt p� konstrukt�ren Oblig3
     * JMenuBar metoden som gir menyen til hovedvinduet.
     * @Param menyList - Peker p� et MenuBar objekt.
     * @Param meny# - Menyene p� menylisten.
     * @Param menyObjekt - Et valg p� gitt meny.
     protected JMenuBar lagMenyList() {
          JMenuBar menyList = new JMenuBar();
          // F�rste menyen
          JMenu meny1 = new JMenu("Fil");
          meny1.setMnemonic(KeyEvent.VK_F);
          menyList.add(meny1);
               // Gruppe1 med JMenuObjekt
               JMenuItem menyObjekt = new JMenuItem("�pne brett", new ImageIcon("bilder/folder.gif"));
               menyObjekt.setMnemonic(KeyEvent.VK_O);
               menyObjekt.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
               menyObjekt.setActionCommand("�pne brett");
               menyObjekt.addActionListener(this);
               meny1.add(menyObjekt);
               menyObjekt = new JMenuItem("Spare brett", new ImageIcon("bilder/floppy.gif"));
               menyObjekt.setMnemonic(KeyEvent.VK_S);
               menyObjekt.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
               menyObjekt.setActionCommand("Spare brett");
               menyObjekt.addActionListener(this);
               meny1.add(menyObjekt);
               meny1.addSeparator();
               menyObjekt = new JMenuItem("Exit");
               menyObjekt.setMnemonic(KeyEvent.VK_ESCAPE);
               menyObjekt.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, ActionEvent.CTRL_MASK));
               menyObjekt.setActionCommand("Exit");
               menyObjekt.addActionListener(this);
               meny1.add(menyObjekt);
          // Lage den andre menyen
          JMenu meny2 = new JMenu("Edit");
          meny1.setMnemonic(KeyEvent.VK_E);
          menyList.add(meny2);
               // Gruppe2 med JMenObjekt
               menyObjekt = new JMenuItem("L�s Brett");
               menyObjekt.setMnemonic(KeyEvent.VK_L);
               menyObjekt.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.CTRL_MASK));
               menyObjekt.setActionCommand("L�s Brett");
               menyObjekt.addActionListener(this);
               meny2.add(menyObjekt);
               menyObjekt = new JMenuItem("Lag eget brett");
               menyObjekt.setMnemonic(KeyEvent.VK_L);
               menyObjekt.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.ALT_MASK));
               menyObjekt.setActionCommand("Lag eget brett");
               menyObjekt.addActionListener(this);
               meny2.add(menyObjekt);
          // Lage den tredje menyen
          JMenu meny3 = new JMenu("Hjelp");
          meny1.setMnemonic(KeyEvent.VK_H);
          menyList.add(meny3);
               // Gruppe3 med JMenObjekt
               menyObjekt = new JMenuItem("Version?");
               menyObjekt.setActionCommand("Version?");
               menyObjekt.addActionListener(this);
               meny3.add(menyObjekt);
               menyObjekt = new JMenuItem("www.dresas.com");
               menyObjekt.setActionCommand("www.dresas.com?");
               menyObjekt.addActionListener(this);
               meny3.add(menyObjekt);
          return menyList;
     } // Slutt p� JMenuBar metoden.
     * Metode som lytter p� menyval mm.
     public void actionPerformed(ActionEvent e) {
          if(e.getActionCommand().equals("�pne brett")) {
               lesFraFil();
          } else if (e.getActionCommand().equals("L�s Brett")) {
               losning();
          } else if (e.getActionCommand().equals("Exit")) {
               System.exit(0);
          } else if (e.getActionCommand().equals("Version?")) {
               version();
          } else if (e.getActionCommand().equals("www.dresas.com")) {
               link();
          } else if (e.getActionCommand().equals("Lag eget brett")) {
               lagEgetBrett();
          } // Slutt p� if-else-if setning.
     * Metoden lesFraFil som ber om navn p� fil fra bruker
     * via grensesnittet.
     protected void lesFraFil() {
          final String losFraFil = JOptionPane.showInputDialog(null, "Skriv inn navn p� filen.");
          svarLesFraFil(losFraFil + ".txt");
     } // Slutt p� metoden losFraFil
     * Metoden svarLesFaFil som gir resultat p� inlesning fra fil.
     protected void svarLesFraFil(String filnavn) {
          boolean rF = br.lesBrettFraFil(filnavn);
          if(rF == true) {
                JOptionPane.showMessageDialog(this, "Filen er lest inn");
          } else {
                JOptionPane.showMessageDialog(this, "Filen ble ikke lest inn,\n (husk sm� og store bokstaver)");
          } // Slutt p� if-else
     } // Slutt p� metoden svarLosFraFil
     * Metoden losning som gir resultat p� l�st brett.
     protected void losning() {
          ru.provAlleSifferMegOgResten(0);
          br.skrivLosning();
     } // Slutt p� metoden losning
     protected void version() {
          JOptionPane.showMessageDialog(null, "Dette er version 0.7");
     protected void link() {
          OpenBrowser op = new OpenBrowser();
          op.displayURL("www.dresas.com");
     } // Slutt p� metoden link
     * Metoden lagEgetBrett som lar brukeren tegne sitt eget
     * brett og l�se det.
     * @Param ramme - Peker p� objektet av klassen InternRamme som
     *                setter opp det interne vinduet.
     protected void lagEgetBrett() {
          int boksBredde = 3;
          int boksHojde  = 3;
          int brettStorelse = 9;
          boolean b1 = true;
          while (b1) {
               boksBredde = Integer.parseInt(JOptionPane.showInputDialog(null, "Skriv inn Bredde p� boksen. (2-4)"));
               if (boksBredde > 1 && boksBredde < 5) {
                    boksHojde  = Integer.parseInt(JOptionPane.showInputDialog(null, "Skriv inn H�jde p� boksen. (3-4)"));
                    if (boksHojde > 2 && boksHojde < 5) {
                         b1 = false;
                    } else {
                         JOptionPane.showMessageDialog(null, "M� vaere mellom 3 og 4.");
                         continue;
               } else {
                    JOptionPane.showMessageDialog(null, "M� vaere mellom 2 og 4.");
                    continue;
          brettStorelse = boksBredde * boksHojde;
          InternRamme ramme = new InternRamme(brettStorelse * 16, brettStorelse * 16);
               Object[][] data = new Object[brettStorelse][brettStorelse];
               for (int i = 0;i < brettStorelse;i++) {
                    for (int j = 0; j < brettStorelse;j++) {
                         data[i][j] = 0;
               String[] columnNames = new String[brettStorelse];
               for (int i = 0; i < brettStorelse;i++) {
                    int b = 1 + i;
                    columnNames[i] = String.valueOf(b);
               JTable sudokuTabell = new JTable(data, columnNames);
               sudokuTabell.setGridColor (new Color (tilfeldig(256), tilfeldig(256), tilfeldig(256)));
               sudokuTabell.setFont(new Font ("Tahoma", Font.PLAIN, 16));
               setVisible(true);
          ramme.add(sudokuTabell);
          ramme.setVisible(true);
          skrivebord.add(ramme);
          try {
               ramme.setSelected(true);
          } catch (java.beans.PropertyVetoException e) {}
     } // Slutt p� klassen lagEgetBrett
     * Metode som returnerer tilfeldigt verdi st�rre en 0 og mindre
     * en maks.
     public static int tilfeldig (int maks) {
          return (int) (Math.random () * maks);
    * Metoden utsyn som tegner opp programmet p� skjermen.
    * @Param frame - Peker p� objektet Oblig3.
    private static void utsyn() {
        //Create and set up the window.
        Oblig3 frame = new Oblig3();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Display the window.
        frame.setVisible(true);
    } // Slutt p� metoden utsyn.
    * Metoden main som starter programmet.
    public static void main(String[] args) {
          javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                utsyn();
     } //  Slutt p� metoden main.
} // Slutt p� klassen Oblig3.
* Brukt av Oblig3
class InternRamme extends JInternalFrame {
     static int tellOpneRammer = 0;
     static final int xOffset = 30, yOffset = 30;
     InternRamme(int bredde, int hojde) {
          super("Lag eget Brett #" + (++tellOpneRammer),
                 true, //resizable
                 true, //closable
                 true, //maximizable
                 true);//iconifiable
          //...Create the GUI and put it in the window...
          //...Then set the window size or call pack...
          setSize(bredde,hojde);
          //Set the window's location.
          setLocation(xOffset*tellOpneRammer, yOffset*tellOpneRammer);
}

Here is the method in mind, translated...
protected void ConstructOwnBoard() {
     int boxWidth = 3;
     int boxHeight = 3;
     int BoardSize = 9;
     boolean b1 = true;
     while (b1) {
          boxWidth = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter Width. (2-4)"));
          if (boxWidth > 1 && boxWidth < 5) {
               boxHeight = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter Height. (3-4)"));
               if (boxHeight > 2 && boxHeight < 5) {
                    b1 = false;
               } else {
                    JOptionPane.showMessageDialog(null, "Must be btween 3 og 4.");
                    continue;
          } else {
               JOptionPane.showMessageDialog(null, "Must be between 2 og 4.");
               continue;
     BoardSize = boxWidth * boxHeight ;
     InternalFrame frame = new InternalFrame(BoardSize * 16, BoardSize * 16);
     Object[][] data = new Object[BoardSize ][BoardSize ];
     for (int i = 0;i < BoardSize ;i++) {
          for (int j = 0; j < BoardSize ;j++) {
               data[i][j] = 0;
     String[] columnNames = new String[BoardSize ];
     for (int i = 0; i < BoardSize ;i++) {
          int b = 1 + i;
          columnNames[i] = String.valueOf(b);
     JTable sudokuTable = new JTable(data, columnNames);
     sudokuTable.setGridColor (new Color (tilfeldig(256), tilfeldig(256), tilfeldig(256)));
     sudokuTable.setFont(new Font ("Tahoma", Font.PLAIN, 24));
     TableColumn column = null;
     for (int i = 0; i < BoardSize ; i++) {
          column = sudokuTable.getColumnModel().getColumn(i);
          column.setMinWidth(25);
          column.setMaxWidth(25);
          column.setResizable(false);
     setVisible(true);
     frame.add(sudokuTable);
     frame.setVisible(true);
     desktop.add(ramme);
     try {
          frame.setSelected(true);
     } catch (java.beans.PropertyVetoException e) {}
} // end of class

Similar Messages

  • JTable problem : how to get the last value entered by user + event lost

    Hi all,
    I have 2 problems with Jtable class.
    1 => To get the last value entered by user in a cell,
    it seems that we must change the selected cell.
    That is to say we can only have the previous cell's value.
    Is there a simple way to get the current value of any cell ?
    2 => To resolve the problem i store the values of each cell in a vector and i intercept keyboard event (!)
    BUT, when i do a double click with the mouse on the Jtable, i loose keyboard events. Then, i can't intercept them.
    Is it a bug of swing or am i following a wrong way ?
    Thanks by anticipation for your help.

    You have to fire the "TableCellUpdatedEvent"
    and override the getCellEditorValue in TableCellEditor to return the current value

  • 1     Unable to retrieve the form values entered by the user from the xpath expression(with or without s

    1.1 Description of the Workflow
    We have designed a Workflow, which has an init form HighLevelQuestionnaire.
    1. The user attempts to start the workflow by submitting this form, which has an XML schema embedded.
    2. When user submits the data, we set workflow variables to fetch data from the init-form and all the values entered by the user are stored in the database.
    3. Based on the values, value of Risk Level is calculated to be either High or Medium, and user is routed to one of the two routes.
    4. The user QPAC is used to show the next form to the user.
    Another form has been designed called AssessRisk in which user is asked to confirm the Risk Level.
    5. At this point, we use Script QPAC to print the values in the log.
    1.2 Problem description
    1. In the Point No. 6 of the workflow, the values are not printed in the log. A blank space is printed instead.
    2. Initially, we embedded the schema in the form. But when values were not printed, we removed the schema. Even then it didnt work.
    1.2.1 User QPAC Specifications
    Properties of user QPAC used in Step 4 of the workflow
    Mappings Tab: -
    Input Variable --- No variable
    Template URL ----- Form11.xdp
    Output Variable ---- myform
    Myform is a form-variable, which has template URL as Form11.xdp
    1.2.2 Script QPAC
    1.2.2.1 With XML Schema embedded
    import com.adobe.workflow.pat.service.*;
    System.out.println("----------- High Level Questions -----------");
    System.out.println("--1- the RiskLevel is: " + patExecContext.getProcessDataStringValue("/process_data/myform/form-data/data/xdp/dataset s/data/RiskLevel/general/Risk_Level") + " @@@@@");
    Note:- Here RiskLevel is the schema root of myform and Risk_Level is the schema variable mapped with textfield on the form
    1.2.2.2 Without XML Schema embedded
    System.out.println("--1.1- the RiskLevel is: " + patExecContext.getProcessDataStringValue("/process_data/myform/form-data/data/xdp/dataset s/data/fields/Risk_Level") + " @@@@@");
    1.2.2.3 Conclusion
    In both the cases, a blank value is printed. In both the cases, we get some output which is when we use
    System.out.println("--1.1- the RiskLevel is: " + patExecContext.getProcessDataStringValue("/process_data/myform/form-data/data/xdp/dataset s/data ") + " @@@@@");
    In this case all the values are printed with space in between.
    This is the basic feature which has to be used while developing workflows.

    Hi
    You might want to try using VariableLogger, at:
    http://www.avoka.com/avoka/qpac_library.shtml
    It's a little more reliable than the script QPAC, especially if one of your xpath expressions is wrong.
    Please note that embedding the schema makes no difference in how the data from the form is stored. What makes the difference is whether your fields are bound to specify schema elements, or whether they use the "normal" binding.
    Howard

  • Retrieving values from a table

    Hi all,
    I need to retrieve values from CSKS-KOSTL for values containing the pattern entered by the user. For example, if the user enters 1, need to retrieve all the KOSTL values starting with 1. But when i write a SELECT statement mentioning where kostl in '1', it is ignoring all the values like (0000001, 00001034, 0012334, and others). Only values starting with 1 is only retrieved as this is a character field and due to conversion routine, zeroes are prefixed while storing in the database.
    Could any one let me know how to retrieve the values from the database in this situation?

    If you want to use IN operator in your where clause then you should define a range variable(R_KOSTL) which refers to CSKS=KOSTL and populate the range as below
    R_KOSTL-SIGN = 'I'.
    R_KOSTL-OPTION = 'CP'.
    R_KOSTL-LOW = '1*'.
    APPEND R_KOSTL.
    and then write your select statement as .... WHERE kostl IN r_kostl.
    The approach suggested by Amit should also work fine.
    Thanks
    Kiran

  • Validate user-entered text in JTable

    How do I validate user entered text in JTable cell, so only the values 1234567890. are acceptet? The cell should contain only doubles....

    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class aslan extends JFrame {
      public aslan() {
        TableModel model = new CustomTableModel();
        JTable table = new JTable(model);
        getContentPane().add(new JScrollPane(table), "Center");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(300,200);
        setLocation(300,300);
        setVisible(true);
      private class CustomTableModel extends AbstractTableModel {
        String[] headings = new String[] {
          "Cost", "Item", "Type"
        Object[][] data = new Object[][] {
          { new Double(12.75), "glue",   "tube" },
          { new Double(15.20), "hammer", "claw" },
          { new Double(8.32),  "saw",    "hack" }
        public int getRowCount() {
          return data.length;
        public int getColumnCount() {
          return data[0].length;
        public Object getValueAt(int row, int column) {
          return data[row][column];
        public void setValueAt(Object value, int row, int column) {
          data[row][column] = value;
          fireTableDataChanged();
        public String getColumnName(int column) {
          return headings[column];
        public Class getColumnClass(int column) {
          return data[0][column].getClass();
        public boolean isCellEditable(int row, int column) {
          return true;
      public static void main(String[] args) {
        new aslan();
    }

  • Retrieve values from a HTML table !!!

    Hi.
    How can i retrieve values from a HTML table using javascript ?
    I´m trying to use the command "document.getElementsByTagName" without success.
    Thanks in advance.
    Eduardo

    Hi, Deepu.
    I´m still with trouble in retrieving the value in HTML.
    In debug the C_CELL_ID seems to be correctly updated but
    when using the command "document.getElementById" the value is always "null".
    I implemented in the method DATA_CELL the code :
      if i_x = 3 and i_y = 2.
      C_CELL_ID             = 'zs'.
      C_CELL_CONTENT = 10. 
      endif.
    And in HTML :
    var ztest = document.getElementById('zs');
    alert(ztest);
    Could you help me please.
    Many regards
    Eduardo S.
    Message was edited by: Eduardo   Silberberg

  • Retrieving values from Database in Excel Task Pane App

    So far,
    I created a website with a database on Azure, I then published my App to Azure. My problem is that I'm not sure how I retrieve values from the database (in SQL: SELECT * FROM EXAMPLE_TABLE WHERE date = str). If someone could provide me with sample code,
    that would be amazing! :D
    It would also be very helpful if anyone knew a method to automatically update the database using information from a xml stream on another website, once a day.
    Thank you!

    Hi,
    >> My problem is that I'm not sure how I retrieve values from the database
    You can use jquery ajax call to call your webserivce or REST API, which will query the database and return a json result.
    Sample:
    Apps for Office: Create a web service using the ASP.NET Web API
    >> It would also be very helpful if anyone knew a method to automatically update the database using information from a xml stream on another website
    For the database sync-up question, I suggest you posting them on the forums like SQL Server Forum.
    Thanks for your understanding.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get the values entered in parameter as comma separated

    Hi friends,
    I need to capture the values entered in the parameter which is entered as comma separated in the srs window o
    for ex in the parameter : 1234,4586,356,.....
    now i need to capture all the values to select in my list of
    employee numbers as
    employee number in(1234,4586,356...)
    how to do this
    pls help

    Please refer to SQL and PL/SQL FAQ
    Sybrand Bakker
    Senior Oracle DBA

  • Question: How do I retrieve values after creating an autofilter.

    So the question is sort of simple but my code is below, this is my first time really running in VBA but it isn't so far all to dissimilar to LotusScript which I am a bit more knowledgeable in. What I am trying to do is retrieve values from the filtered information,
    or more simply, I am trying to retrieve values from two cells in the spreadsheet that I want move together.
    As noted below one of them is a countries field which simply concatenates the country string with the duplicates with the same first column (A#) fields. 
    Example 123 .. UK
                  123 .. US
                  123 .. CA
    The output stored in countries would be UK,US,CA and posted to sheet3.
    Sub proFirst()
    Dim wSheet As Worksheet
    Dim columnCount As Integer
    Dim rowCount As Long
    Dim testVar As Long
    Dim coll As New Collection, a
    Dim Assignee() As String
    Dim tmpList() As String
    Dim newVar As Variant
    Dim dict As Object
    Const rowDataBegin = 2
    Dim count As Long
    rowCount = Sheets("Sheet1").UsedRange.Rows.count
    columnCount = Sheets("Sheet1").UsedRange.Columns.count
    '** This Cleans up the filtering to ensure all data is viewable before we begin **
    Sheets("Sheet1").Activate
    If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
      ActiveSheet.ShowAllData
    End If
    Sheets("Sheet3").Activate
    If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
      ActiveSheet.ShowAllData
    End If
    '** This sets a filter to filter by column O which is designated as Submitted Date  **
    Sheets("Sheet1").Columns("A:S").AutoFilter Field:=15, Criteria1:="<>"
    '** This block copuies and pastes the values we need for the final report however   **
    '** this is not a permenent viewable format for the report, a recut may be required **
    Application.CutCopyMode = False
    rowCount = Sheets("Sheet1").UsedRange.Rows.count
    Sheets("Sheet1").Range("A1:D" & rowCount).Copy Sheets("Sheet3").Range("A1:D" & rowCount)
    Application.CutCopyMode = False
    Sheets("Sheet1").Range("J1:J" & rowCount).Copy Sheets("Sheet3").Range("H1:H" & rowCount)
    Application.CutCopyMode = False
    Sheets("Sheet1").Range("O1:O" & rowCount).Copy Sheets("Sheet3").Range("I1:I" & rowCount)
    Application.CutCopyMode = False
    'loops through the first column and acquires all of the data and generates as string array
    rowCount = Sheets("Sheet3").UsedRange.Rows.count
    columnCount = Sheets("Sheet3").UsedRange.Columns.count
    ReDim Assignee(rowCount)
    ReDim tmpList(rowCount) 'helper variant to make it smoother for recall of lines
    For i = rowDataBegin To rowCount
        Assignee(i - rowDataBegin) = CStr(Sheets("Sheet3").Cells(i, 1).Value)
        tmpList(i - rowDataBegin) = rowCount
    Next i
    Set dict = CreateObject("Scripting.Dictionary")
    For i = LBound(Assignee) To UBound(Assignee)
       If dict.exists(Assignee(i)) Then
            dict.Item(Assignee(i)) = dict.Item(Assignee(i)) + 1
             Else
            dict.Add Assignee(i), 1
        End If
       Next i
    Sheets("Sheet3").Range("$A$1:$I$" + CStr(rowCount)).RemoveDuplicates Columns:=1, Header:=xlYes
    rowCount = 2
    Application.Workbooks(1).Worksheets("Sheet3").Activate
    '** Header values Change as needed                                                             
    Sheets("Sheet3").Cells(1, 5).Value = "Completed Global Questionnaire? (Yes or No)"
    Sheets("Sheet3").Cells(1, 6).Value = "Number of Countries"
    Sheets("Sheet3").Cells(1, 7).Value = "Name of Countries Submitted"
    For Each v In dict.keys
    If dict.Item(v) > 0 And v <> "" Then
    Sheets("Sheet3").Cells(rowCount, 6).Value = dict.Item(v)
    rowCount = rowCount + 1
    End If
    Next v
    Sheets("Sheet3").Columns("A:I").AutoFilter Field:=6, Criteria1:=">1", _
            Operator:=xlAnd
    '** BEGIN TESTING AREA
    '** Stage 2 Test Complete - able to retrieve a list of how many rows are in use
    '** Stage 3 test - retrieve countries
    Sheets("Sheet1").Activate
    count = 2
    For Each v In dict.keys
    countries = ""
    rowCount = 0
    If dict.Item(v) > 1 Then
        With ActiveSheet
           Set rnData = .UsedRange
            With rnData
                .AutoFilter Field:=1, Criteria1:=v
               .Select
                'xlCellTypeVisible = 12
                 For Each rngArea In .SpecialCells(xlCellTypeVisible).Areas
                 tmp = .SpecialCells(xlCellTypeVisible).Rows
                Next
                For Z = 2 To rowCount
                    If countries = "" Then
                        countries = .Range("I" & Z).Value
                    Else
                        countries = countries & ", " & .Range("I" & Z).Value
                    End If
                Next Z
            End With
        End With
         Sheets("Sheet3").Cells(count, 7).Value = countries
    End If
    count = count + 1
    Next v
    '**  Testing block              **
    Sheets("Sheet3").Columns("A:I").AutoFit
    MsgBox "End loop"
                                                

    The code below is only semi-tested but it should give you the idea of how to loop through the visible data of an AutoFiltered Range. You can't use code like "For r = 2 to Rows.Count" because the code stops after the first non contiguous row. However,
    you can use For Each loop to loop through the rows and get the row number from there.
    An explanation of the code to set rngVisible. (Note that a space and underscore at the end of a line is a line break in an otherwise single line of code.)
    With .AutoFilter.Range   This is the entire AutoFilter Range (Includes column headers, visible and non visible rows)
     .Offset(1, 0)     Moves down one row off the column headers but now includes an additional row at the bottom below the data. (Still includes visible and non visible rows)
     .Resize(.Rows.Count - 1, .Columns.Count)     Removes the additional row due to Offset (Still includes visible and non visible rows)
    .SpecialCells(xlCellTypeVisible)      Only include the visible rows.
        Sheets("Sheet1").Activate
        For Each v In dict.keys
            countries = ""
            If dict.Item(v) > 1 Then
                With ActiveSheet
                    Set rnData = .UsedRange
                    With rnData
                        .AutoFilter Field:=1, Criteria1:=v
                    End With
                    'Note that AutoFilter.Range is an inbuilt object variable _
                    for the entire range covered by the AutoFilter
                    With .AutoFilter.Range
                        'Following tests if any rows (other than column header) are visible _
                        in the AutoFilter.Range.  If > 1 then more than just column headers. _
                        Attempting to set the rngVisible will error if not at least one row _
                        of visible data.
                        If .Columns(1).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
                            'Assign the visible data to a range variable
                            Set rngVisible = .Offset(1, 0) _
                                       .Resize(.Rows.Count - 1, .Columns.Count) _
                                       .SpecialCells(xlCellTypeVisible)
                        Else
                            MsgBox "No visible data. Procesing terminated."
                            'Left for you to handle what you want to do if the _
                             filter does not exist in the data and no visible rows present
                            Exit Sub
                        End If
                    End With
                    'Loop through the rows of rngVisible
                    'and get the row numbers
                    For Each rngRow In rngVisible.Rows
                        Z = rngRow.Row
                        If countries = "" Then
                           countries = .Range("I" & Z).Value
                        Else
                           countries = countries & ", " & .Range("I" & Z).Value
                        End If
                    Next rngRow
                End With
            End If
        Next v
    Regards, OssieMac

  • How to retrieve value from AIAInstallProperties.xml in AIA Flow.

    After PIP Developement, Installer team will build the OUI installer for the PIP.They will build the screens for our PIP based on the requirements we give them.We give them a list of properties that we need the installer to prompt for and then the installer will store the values entered by the user in AIAInstallProperties.xml file.When the code is written, these properties are used instead of hardcoding any machine names, usernames, passwords, etc. When the services are deployed the properties are replaced with the values in AIAInstallProperties.xml.
    How to retreive those values from AIAInstallProperties.xml file to your participating applications or any adapters in your code?
    When the services are deployed how the properties are getting replaced with the values in AIAInstallProperties.xml.?
    Can anyone explain the above two flow.
    Thanks in advance.

    Hi
    Prem Edwin's posting about AIAInstallProperties.xml is correct.
    Two points, the 11gR1 is a foundation pack only release, that is why the OUI is only built to collect FP related information. In the future, when PIPs arrive, new wizard steps will involve to collect PIP specific information during installation/deployment time.
    For your example of of getting a file location during installation, it would be effectively for your self-built PIPs. That is why the 11gR1 FP OUI would not support that.
    Also, there are only finite number of tokens can be detokenized from AIAInstallProperties.xml to composite.xml, if you were introducing a random new 'file path', I don't believe it would be replaced automatically by default in R1 time.
    Thanks!

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • Error Message - Value Entered Does Not Match Format of Field

    I keep getting an error message in Adobe Pro X: "The value entered does not match the format of the field [JF13]".
    I have JF13 programmed as follows:
    On Calculate tab:
    if(Number(this.getField("ck4").value) > 0) this.getField("JF13").value = Number(this.getField("FL019").value); else this.getField("JF13").value = " ";
    It is programmed this way so if the user checks the check box before the field, only then will JF13 populate a value, which pulls from FL019. I also have the settings set to "number" because the data needs to display as a dollar amount $xxx.xx.
    FL019 is a hidden field on the form which pulls a dollar amount from a Mainframe, and its settings are also set to "Number" :
    I get four pop up windows with the above mentioned error message, and the only way to make the message stop is to remove the "number" format from the fields. However, when this is done, if any number which ends in a zero is entered, it cuts off the zero. This is not acceptable either.
    Is there some sort of script I could add or some other way to prevent both the error message and the cutting off of the zero on JF13?
    I am not very proficient with javascript, so any assistance would be appreciated!

    Thank you so much for your response!!
    Forgive me for my lack of knowledge - but where exactly would I add that in the script?
    I tried it like this:
    if(Number(this.getField("ck4").value) > 0) this.getField("JF13").value = Number(this.getField("FL019").value); else this.getField("JF13").value = ""(empty string);
    And I got an error saying I was missing a parenthesis. Should it go somewhere else or am I completely off?

  • F4 Help IN ALV (OOPs) based on value entered in Other colunm.

    Hi,
    I have developed a module pool using ALV GRID Display.
    i have two fields in it. and for the second field i should provide F4 help. and the list in the f4 help should be based on the value enterd in first column.
    below is my code.
    MODULE BPO_100 OUTPUT.
    DATA: LT_FCAT TYPE LVC_T_FCAT.
    DATA: ls_fcat    TYPE lvc_s_fcat.
    DATA: wa type t_znout.
    *DATA: it_kd1 LIKE zish_pm_cs_kd1fd OCCURS 0 WITH HEADER LINE.
    SELECT * FROM zish_pm_cs_kd1fd INTO TABLE it_kd1 WHERE einri = rnpa1-einri.
      IF sy-subrc = 0.
        SORT it_kd1 BY sno.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM it_kd1 COMPARING fieldname.
    LOOP AT it_kd1 into wa.
    clear wa-value.
    MODIFY it_kd1 FROM wa.
    ENDLOOP.
           ls_fcat-fieldname = 'FIELDNAME'.
           ls_fcat-scrtext_l = 'Field name'.
           ls_fcat-scrtext_m = 'Field name'.
           ls_fcat-scrtext_s = 'Field name'.
           ls_fcat-tabname   = '1'.
           ls_fcat-col_pos = '1'.
           ls_fcat-outputlen = 15.
           APPEND ls_fcat TO lt_fcat.
           ls_fcat-fieldname = 'VALUE'.
           ls_fcat-scrtext_l = 'Value'.
           ls_fcat-scrtext_m = 'Value'.
           ls_fcat-scrtext_s = 'Value'.
           ls_fcat-tabname   = '1'.
           ls_fcat-col_pos = '2'.
           ls_fcat-outputlen = 15.
           ls_fcat-edit = 'X'.
           ls_fcat-f4availabl = 'X'.
           APPEND ls_fcat TO lt_fcat.
    IF G_CUSTOM_CONTAINER1 IS INITIAL.
    create a custom container control for our ALV Control
        CREATE OBJECT g_custom_container1
            EXPORTING
                container_name = g_container1
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
            IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'ZISH_SCRN_ALV'
              txt2  = sy-subrc
              txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container1.
      CALL METHOD grid1->set_table_for_first_display
               EXPORTING
                i_structure_name = 'ZISH_PA_ZNOUT'
          i_default        = gs_test_1700-vari_default
                 i_default        = 'X'
                i_save           = gs_test_1700-vari_save
                is_variant       = ls_vari
                is_layout        = gs_layout1
               CHANGING
                 it_outtab        = it_kd1
                 IT_FIELDCATALOG  = LT_FCAT.
    ENDIF.
    ENDMODULE.                 " BPO_100  OUTPUT
    Edited by: Guru Ram on Sep 24, 2009 8:58 AM

    See sample code.
    I have 2 fields  MATNR and DESC in screen 100. Change it according to ur needs.
    In screen flow logic,
    PROCESS ON VALUE-REQUEST.
      FIELD  desc MODULE module_desc. " F4 for screen field DESC based on value entered in field MATNR
    In report,
    MODULE module_desc INPUT.
      TABLES: ddshretval.
      DATA:  l_t_dynpread LIKE dynpread OCCURS 0 WITH HEADER LINE,
               l_t_dynpread1 LIKE dynpread OCCURS 0 WITH HEADER LINE.
      DATA: l_t_retdynr TYPE TABLE OF ddshretval,
              l_wa_retdynr LIKE LINE OF l_t_retdynr.
      DATA: BEGIN OF g_t_desc OCCURS 0,
            maktx TYPE makt-maktx,
            END OF g_t_desc,
            wa LIKE g_t_desc.
      l_t_dynpread-fieldname = 'MATNR'.  " Field1 name
      APPEND l_t_dynpread.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = sy-repid
          dynumb               = '0100'
        TABLES
          dynpfields           = l_t_dynpread
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      READ TABLE l_t_dynpread INDEX 1.
      IF l_t_dynpread-fieldvalue IS NOT INITIAL.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'  " Converting matnr to 18 digits
    EXPORTING
    input = l_t_dynpread-fieldvalue
    IMPORTING
    output = l_t_dynpread-fieldvalue.
        SELECT maktx FROM makt INTO TABLE g_t_desc WHERE matnr = l_t_dynpread-fieldvalue.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
                EXPORTING
                  retfield        = 'MAKTX'
                  dynpprog        = sy-repid
                  dynpnr          = sy-dynnr
                  value_org       = 'S'
                TABLES
                  value_tab       = g_t_desc
                  return_tab      = l_t_retdynr
                EXCEPTIONS
                  parameter_error = 1
                  no_values_found = 2
                  OTHERS          = 3.
        READ TABLE l_t_retdynr INTO l_wa_retdynr INDEX 1.
        IF sy-subrc = 0.
          l_t_dynpread1-fieldname = l_wa_retdynr-fieldname.
          l_t_dynpread1-fieldvalue =  l_wa_retdynr-fieldval.
          APPEND l_t_dynpread1.
          l_t_dynpread1-fieldname = 'DESC'. " Field2 name
          APPEND l_t_dynpread1.
          CALL FUNCTION 'DYNP_VALUES_UPDATE'
            EXPORTING
              dyname               = sy-repid
              dynumb               = sy-dynnr
            TABLES
              dynpfields           = l_t_dynpread1
            EXCEPTIONS
              invalid_abapworkarea = 1
              invalid_dynprofield  = 2
              invalid_dynproname   = 3
              invalid_dynpronummer = 4
              invalid_request      = 5
              no_fielddescription  = 6
              undefind_error       = 7
              OTHERS               = 8.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " module_desc  INPUT
    Thanks.

  • Pre-populating a date/time column with the value entered in the last added item

    I have a list with a column called "expected finish date". Whenever the user adds the very first item in a list, he/she should have to enter a value for this column.
    I want to make all new item entries to pre-poplate this field with the value entered in the previously added item. This way, he/she wont have to re-enter the date every time (which rarely changes). How can this be done?

    could create a second list ("state") with column ("default finish date")...
    create a workflow on main list... if column is blank/empty, pull from second list... otherwise, update second list with the value that was entered.
    Or, customize the form (InfoPath or JavaScript)
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Update age group picklist based on value entered in date of birth

    Hi Gurus,
    Have a requirement where in user would enter the date of birth on a contact record and would like to populate another custom field called age group at the time of creating a new record.
    The condition is some what like
    Age
    1 – 20 Teens
    21-40 Young Adults
    41-60 Adults
    60 – 100 Seniors
    I have tried using the age field but problem is that age is populated only when the record is saved.
    Update the age group via workflow works fine but the saved record has to be modified before triggering the workflow. we would like to avoid the additional step of modifying the record
    Is there any option to calculate age based on the value entered for date of birth - something like DOB Year - current year before saving a record or via post default without using workflows.
    Thanks in advance,
    Arun

    Hi
    The answer is yes, using the post default functionlaity.
    take a look in the folowign example:
    IIf(ToChar(Timestamp(),'DD/MM/YYYY')- [<DateofBirth>] < 20,'20','30')
    You will need to make something like that, but replace the '30' with another IIf expression, and so on for the next interval.
    note that date of birth should be between suqare brackets [  ] (it is shown here with underline for some reason...)
    Good luck
    Guy
    Edited by: Shinshan on 08:45 30/12/2009
    Edited by: Shinshan on 08:46 30/12/2009
    Edited by: Shinshan on 08:47 30/12/2009
    Edited by: Shinshan on 08:47 30/12/2009

Maybe you are looking for

  • Upgrade os x 10.3.9

    I have just been given a wonderful gift of a Mac G5 from a friend. I have limited exposure to Mac's but have done some work with them. The problem I am having is with using the internet. The safari doesn't download the sites right and I can't get fir

  • Why my sent emails are not showing up in the sent box

    The emails I'm sending are not showing up in my sent box. Why is this happening? 

  • No Icon for newly opened software in the DOCK

    i am reconfiguring my dock (starting fresh and long story) and i am opening software (for instance Messages) for the first time so that i can run a KEEP IN DOCK as i reorganize this data and for some reason i am not seeing an ICON for this software i

  • What is this error message pls?

    Can anyone tell me what this means? and what I could do to sort it out? When I shut down my computer it comes up with a screen saying "Continue the installation?" if I answer yes the above flashes on the screen for a few seconds and then disappears.

  • Strange icons behavior on Finder and Dock

    Hi! I've purchased a new MacBook and am in the process of transforming my old iBook G4 into a sort of netbook for Web and iWork but am having some strange problems. This notebook served me very well for several years but I decide to clean it after th