Two dimensional field

hi to all of U.i`m trying to make a two dimensional field size of 4x4 that would write all numbers,who are in this fields,on screen.any hint would be helpful.

Hi sorry for the late reply. I haven't come to my computer since the last time. When I said you were half way it was actually an undersatement. You have done 90% of the work. With the hint I gave you would have been able to complete it. Here is the complete code any way. Hope this is what your program supposed to do:
public class Fourbyfour {
   public static void main (String[] args) {
     int x[][] = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}};
     for (int i = 0; i<4; i++) {
       for (int j=0; j<4; j++)
          if ( x[i][j] > 9)
             System.out.print(x[i][j]+" ");
          else
            System.out.print(x[i][j]+"  ");
       System.out.println();
}

Similar Messages

  • Create a two dimensional table in Acess

    Hi,
    I am working with a database and the toolkit "the database connectivity tooset". I know how to create a new table from labview, but is it possible to create a "two dimensional" table from labview, i.e, where one table in Microsoft Access is linked to another one. I know how to do it in access, but it should be possible in program to crate a new table and this one has to be linked to another one then, just like the others. Does someone know how to do it??
    Thank you!

    Hi
    I assume you are not so familiar with databases, are you?
    First I want to comment your previous post:
    well I have a table for a product that contains, say different data for the product, i.e. the date of the test, who is responsible for the test, where it was performed. Also, linked to the date (I guess it is the primary key), there are also some data related. so in my table in the database, next to the date, there is a "+"-sign, so I can open up the page of all the data related to the date.
    Well, did you create this database on your own? So you must have created two tables (table one with fields Datum, Responsible & Cost and table two with fields Place1, Place2, Place3 & Place4). Then you must have dragged on field from one table to another field in the other table in the "Relations" view of access. Doing so, you created a relation. Due to this, access now knows how this date is related and displays the "+"-sign. You can not assume that the date is the primary key.
    In fact you do not have a "2D" table, but just different datasets from two tables connected to each other. This connection is created by relations.
    So, if I know would like to create a new table in my program (each product has its own table, so a new product=a new table), I would also like to create this "data" sheet that is connected to the data. Bu how do I do that?
    I can easily just create a new table (i.e. a new product), just using the "DB Tools Create Table.vi". But I guess it is when I actually want to add the data to the database, where I create the "data" sheet? Using the "DB Tools Execute Query" and a SQL statement with INSERT INTO, is that the way to go?
    As mentioned before, this "datasheet" is just a dataset from a second table which is made displayable by the relation. So if you're question is "how to create a relation using LV", you are quite on the right way. First create two tables one of which has to contain a field where the primary key from the other table is linked to. Then you have to set a PK in one table (using SQL statements) and then build the relation (also using SQL statements). I can't tell you, if you have to define the foreign key in the second table too.
    Have a look at the MS-Access help on how to assign relations and how to define primary keys. There may be something to take care off. Basically standard SQL should do - but using MS you never know .
    As this is somehow complicated, I always create the database structure in MS Access and that's it - afterwards all is done programatically (write and read data). Usually I don't open the database again with Access unless there is a special task.
    Hope this helps you a little bit otherwise come and ask again.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How to use two dimensional array in custom.pll

    HI
    How to use two dimensional arrays in custom.pll
    I tried by the following way .
    type ship_array is table of number index by binary_integer;
    type vc_array is table of ship_array index by binary_integer;
    But I am getting the error as that
    A plsql table may not contain a table or a record with composite fields.
    Please tell me the way how to use them

    which forms version are you using? two dimensional arrays are available in >= 9i if memory serves.
    regards

  • Retrieving  two dimensional arrays from a text file.

    Good evening
    I am having a problem with reading a text file, and putting this info into a 2D array to be put into a table.
    I have the table already(but no code to add rows to the table incase the array increases)
    The array is called Product[a][ b ]
    where a is the product number(the row), and b are details about this product.
    The file i want to be read looks like this:
    data.txt
    CPU|AMD|X2, 64bit, 2GHz|$150|9
    Video card|NVidia|7800 GTX 256MB|$400|4
    e.g. product[2][4] would equal 4
    Basically: Type, manufacturer, specifications, price, amount in stock.
    the "splitter" or "field terminator" is "|"
    This is what i want it to do:
    Store fileline into single string,
    split string and put it in product[ j ][ i ]
    repeat with next lines until nothing is read anymore.
    This is the code I have so far:
    try{
            FileReader textFileReader = new FileReader("C://BACKUP2//data.txt");
            BufferedReader textReader = new BufferedReader(textFileReader);
            for(int j=0; j<0; j++){
                 for(int i=0; i<6; i++){ //i starts at 0, condition: i is under 6, 1 is added to i at each loop/update.             
                       ProductT = textReader.readLine();
                       textReader.close();
                       for(String Product[j] : ProductT.split("|")){ //this line is completly wrong, but i don't know how else to do it.
         // for counting for the number of columns
    catch (IOException e) {System.out.println(e);}
    I don't even think this code makes any bloody sense, I don't know if I'm approaching it correctly.
    Would anyone be gracious enough to give me a helping hand and tell me what/how to change my code?
    from what I see, the problem lies less in the loops, but more in the splitting of the string. no function seems to like 2D arrays :(

    So this is where I stand:
         //Reading
        try{
            FileReader textFileReader = new FileReader("C://BACKUP2//data.txt");
            BufferedReader textReader = new BufferedReader(textFileReader);
            for(int j=0; j>0; j++){ // this will go on forever now or what?
    // yes, this will loop forever, which is fine as long as you break out of the loop when you reach the end of the file (which is indicated by textReader.readLine() returning null)
                 // replace the for(String currentField : ProductT.split("|")) loop with this one
                 //for(int i=0; i<6; i++){ //i starts at 0, condition: i is under 6, 1 is added to i at update.       
                      String inputline = textReader.readLine();    // read a single line from the file each time through the loop
                      //while (inputline != null) {
                            if (inputline != null) {    // check if the end of the file has been reached
                           //ProductT = textReader.readLine(); //put to single string
                       //textReader.close(); //shut it off    // move this line to the end of processing, you don't want to close the file until you've read everything from it.
                       //for(String currentField : ProductT.split("|")){   //Split string...      according to JBuilder "The local variable currentField is never read"
                             // switch this loop to use the regular for(  ;  ;  ) type, that way you will have another counter to use as the second index in the product assignment
                                         //currentField = Product[j];
                        product[i][] = currentField; // use the index of the second loop as the second index here
    else {
    break; // break out of the loop when end of file is reached
         //} // the for i etc. end here
    } // End for j et cetera...
         } //end Try
    catch (IOException e) {System.out.println(e);}
    //cut the crap
    // close the reader here
    ok - so I am not quite sure about what you mean here
    "Assign each of the 5 fields to the five [][j]
    positions of the array. "
    should i put 5 "fors" in there? - currently the
    program is compiling - although they do not appear in
    the table.I put comments in the code that should answer those questions.
    The code for the table is
    Object[][] data = {
              {Product[0][0], Product[0][1],
                   Product[0][2], Product[0][3], Product[0][4]},
                   {Product[1][0], Product[1][1],
    Product[1][2], Product[1][3],
    uct[1][3], Product[1][4]},
                          {Product[2][0], Product[2][1],
    Product[2][2], Product[2][3],
    ct[2][3], Product[2][4]},
                              {Product[3][0], Product[3][1],
    Product[3][2],
    Product[3][2], Product[3][3], Product[3][4]},
                    {Product[4][0], Product[4][1],
    Product[4][2],
    Product[4][2], Product[4][3], Product[4][4]},
    ;If I do not declare any of these strings (e.g. I have
    only declared Product[0-2][] oldschol style) an error
    occurs, telling me that
    Caused by:
    java.lang.ArrayIndexOutOfBoundsException: 3
         at data.<init>(data.java:112)
         ... 5 more
    When you declare product, you'll need to give it a size for both dimensions. The first dimension will be the number of lines to be read from the file. You'll need to know this before allocating the array, so either count them in the file, (if that's good enough for this assignment) or loop through the file once before reading it to count the lines. The second dimension of the array will be 5, since that's how many fields each line has.
    btw; do I give those duke stars when all problems of
    my life(currently: reading the two dimensional
    string) have been resolved?I don't know about [i]all the problems of your life, but when the topic of the thread has been solved, then give them to whoever helped. :)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Two dimensional Grouping

    Hi 2 all,
    I'm trying to build a report starting from two complex PL/SQL query like this(simplified):
    SELECT SUM(x),SUM(y),SUM(z),Name,type,product
    FROM DESC A, STORE1 B, STORE2 C, store3 D, store4 E
    WHERE b.ID=c.ID(+)
    AND b.ID=d.ID(+)
    AND b.ID=e.ID(+)
    AND a.code=b.code
    AND a.product='oneproduct'(...another query with !='oneproduct')
    group by b.Name,b.type
    I need to have on each report page the results of the two queries grouped by type, one page for each (Name).
    how can I have the content of Name field on the header/margin (as a title) and the remainder data below grouped by the same Name?
    =&gt; In the end I should have one page for each Name
    thanks
    Matteo

    On the other hand I do recall having read somewhere
    that the "new" operator
    is very costly and should strictly be
    avoided in loops.Not that expensive performance-wise. It could potentially suck up a lot of memory if you are creating LOTS of objects
    Now for the concrete case of reading some user's
    datasets from a database
    and then processing them further, is it advisable
    to instantiate a new user object for each row, or
    where is the alternative
    to be found?I think you should create an object to represent each row.
    two dimensional collections (any favourites in java)I always create my own. I try to use Vectors and Hashtables exclusively, depending on my needs re: ordering and lookup. Mixing and matching these could result in Vectors of Hashtables, Vectors of Vectors, Hashtables of Vectors, and Hashtables of Hashtables.
    synchronized one dimensional collections each
    representing one field in a
    table ? (is this really more performant than simple
    classes)Doubtful - any gain that you get by avoiding the constructor call would be obviated by the overhead of iterating through multiple lists and keeping them synchronized.
    a Collection of Collections (here comes the new
    operator again)Same as two-dimensional collections.
    I remember having seen inner classes used for the
    purpose of holding just a
    couple of attributes, is there some performance
    advantage like "the class
    loader does not have to look for the class".No advantage - the only reason to create an inner class is to prevent other classes from using those objects. The inner class still compiles to a separate class object that needs to be loaded separately.

  • Problem returning a two-dimensional array in web service

    Hello. I'm having problems returning a two dimensional array in my web service. The service returns a MyClass[][] correctly, but the client receives a different one.
    I've done a test that returns a MyClass[1][1] an the client shows a MyClass[1][20]. All the MyClass objects returned in the array are the same and all it's fields are null. There's even an element of the array containing null instead of the object. As I say, the service creates the array ok, but the client gets other thing.
    I have other methods returning one-dimensional arrays MyClass[] and I have no problem.
    My system:
    WindowsXP
    Tomcat 5.5 (Axis 1.3?)
    JDK 1.5
    Eclipse 3.3
    My wsdl is generated with eclipse, although I've had to update my wsdd manually.
    Any Ideas?
    Thanks.

    Does it have to be stored in an array?
    Because you could use the java.awt.Point class, and a
    java.util.Set to create random points until you have
    the correct number of unique points.Of course it is no must to store it in an array. it was just my first thought of approaching the problem. I will try the Point.class. Thanks for that hint.

  • Mapping question - one dimensional to two dimensional

    Hi
       We are on XI 3.0 SP13 - and I have this mapping scenario
    Source structure - Linear & simple with say 10-20 fields -
    Target structure - Name -value field pair with an unbounded node on top -
                                <b>MsgAttrib 0-Unbounded
                                    Name
                                    Value</b>     
    I have to map each distinct field value from the source structure - to the Value field on target structure. The Name field in the target structure should contain the name of the source field ( it can contain a constant - field name if we cannot get the source element name during mapping runtime, thats ok )
    So basically each elementname and its value on the source structure form a record on the target xml. The next source element and its value will be mapped to the next record on the target xml - this filling up the two dimensional target structure - with as many rows as the number of source fields to be mapped. The number of such source fields to be mapped can grow . ( there should not be any limitation on that )
    Can this be accomplished using standard functions in message mapping - or should we resort to writing udfs ?
    Any right thoughts, solutions to solve this mapping scenario will be awarded points rightaway .....

    Hi karthik,
    The mapping that ur scenario requires can be accomplished using the standard functions...
    now ur source structure is unbounded...tht means it can have multiple occurences...
    and for each occurence you have a pair of values in target message under a node....
    now the important thing here is ..tht ur target node which has those two fields under it will repeat as many times as occurences of the source message...
    so u  need to map the main message type node of the source to this node in target...
    and according map the fields under tht node...
    UDF's are not required for this....
    Regards ,
    Sushil Hadge

  • Querying data from two dimensional schemas

    Hi,
    I have modified 2 star models on Physical layer, then I add three tables from these models into BMM Layer: Fact A, Fact B and Dim C.
    Dim C is joined logically (using complex join) with Fact A and Fact B.
    In Answers I make a request with fields from tables A, B and C, but got this error:
    [nQSError: 10058] A general error has occurred. [nQSError: 15018] Incorrectly defined logical table source (for fact table Fact B) does not contain mapping for [Fact A].
    Someone can tell me how can I solve this issue??? or how to get this fields???, join both star models logically or physically is possible???
    Thanks
    Carlos Hernandez

    Venkatakrishnan:
    My first post was solved creating a single logical fact table with both physical facts as sources, joining this with all the dimensions that I need, also I created a hierarchy for each one, and finally I define dimension levels in facts sources and metrics.
    The BMM has the particularity that involves two dimensional schemas at total and detail level: Order Fact and OrderItem Fact, and is joined with several dimensions: Account, Order, Product, Position, Day, Person, and with two new objects: a view named "Ordenes" and a table named "Item Atributos". Specifically this view has no physical join with OrderItem Fact, so that was my principal headache.
    I defined #Order and #OrderLines metrics in the logical fact table and I could create a request with columns from all tables (fact and dim) and seems that it works, but now I have another problem: when I try to filter for a detail dimension column I get this error:
    [nQSError: 14023] None of the fact sources for [Table.Column] are compatible with the detail filter [FILTER].
    This error only happens when I include columns in request from "Ordenes" dim(physically defined as a custom view).
    Could you know the cause of the problem or why this error is happening???
    Thanks for your help again.
    Carlos Hernandez

  • Please change the view in the top sites, the 6.1 upgrade has reverted back to a plane two dimensional view, which is a little plain. Can I revert back to an older version via my time capsule save?

    Please change the view in the top sites, the 6.1 upgrade has reverted back to a plain two-dimensional view, which is a little dated. Can I revert back to an older version via my time capsule save? C'mon Apple upgrades supposed to leap into the future not the past. :-(

    Please change the view in the top sites, the 6.1 upgrade has reverted back to a plain two-dimensional view, which is a little dated. Can I revert back to an older version via my time capsule save? C'mon Apple upgrades supposed to leap into the future not the past. :-(

  • Working days between two date fields and Changing Factory Calendar

    Hi,
    I have to calculate working days between two date fields excluding the weekends and public holidays for Switzerland.
    I have written the routine using factory calender and its working fine except for two problems now:
    1. If any one of the date field is empty then teh rsult should be zero.
    2. And the below code is working from 1996 but my cleints wants it to work for years before 1996 as well.
    I also tried to change the Start date in SCAL for factory calendar but it says enter values between 1995 to 2020.
    I am new to ABAP. Please help me how i can achieve these for below code.
    DATA: IT_HOLIDAYS type TABLE OF ISCAL_DAY,
          IS_HOLIDAYS TYPE ISCAL_DAY.
    DATA: T_DATE TYPE SY-DATUM,
          P_DATE TYPE SY-DATUM.
    DATA : X_DATE(4) TYPE C.
    DATA: CNT TYPE I.
    REFRESH : IT_HOLIDAYS.
    CLEAR : IT_HOLIDAYS.
    T_DATE = SOURCE_FIELDS-/BIC/ZCCCHP812.
    P_DATE = SOURCE_FIELDS-/BIC/ZCCCHP810.
    CALL FUNCTION 'HOLIDAY_GET'
    EXPORTING
    HOLIDAY_CALENDAR = 'CH'
    FACTORY_CALENDAR = 'CH'
    DATE_FROM = P_DATE
    DATE_TO   = T_DATE
    TABLES
    HOLIDAYS = IT_HOLIDAYS
    EXCEPTIONS
    FACTORY_CALENDAR_NOT_FOUND = 1
    HOLIDAY_CALENDAR_NOT_FOUND = 2
    DATE_HAS_INVALID_FORMAT = 3
    DATE_INCONSISTENCY = 4
    OTHERS = 5.
    DESCRIBE TABLE IT_HOLIDAYS LINES CNT.
    X_DATE = T_DATE - P_DATE - CNT.
    RESULT = X_DATE.
    Please help
    Regards
    Zabina
    Edited by: Syed786 on Nov 2, 2011 9:15 AM

    Hi Zabina,
    Try this function module  'DURATION_DETERMINE'.
    Give the factory calendar and unit as DAY
    With regards,
    Rajesh

  • Formula for compare two date fields

    Please help me,
    There are two date fields in DSO , I want to create a key figure by Query Designer, the condition as blow
    Count ( If field DateA > field DateB = 1 else 0 ).

    http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
    create 2 formula varaibles like above and comapre it

  • How to get number of rows and columns in a two dimensional array ?

    Hello,
    What would be the simplest way to get number of rows and columns in a two dimensional array represented as integers ?
    I'm looking for another solution as For...Each loop in case of large arrays.
    Regards,
    Petri

    Hi Petri,
    See a attached txt file for obtaining two arrays with upper and lower index values
    Regards
    Ray
    Regards
    Ray Farmer
    Attachments:
    Get2DArrayIndex.txt ‏2 KB

  • How do I make a form field validate that it is the sum of two other fields?

    Hi there,
    I am creating a form, and I would like one of the fields to validate by making sure that this field is the sum of two other fields in the form.  Does anyone have any ideas on how to go about this?  I know I'll need to run a custom validation script, but I'm not sure where to begin - I've never done one for validation before.
    Thanks for any help!

    OK, here's a sample script that I hope will clearly demonstrate the general approach. It is intended to be the custom Validate script of the field that the user enters that value that is supposed to be equal to the sum of the two others.
    // Custom Validate script
    (function () {
        // Get the value that the user entered
        var sVal = event.value;
        // If it is blank, do nothing else
        if (!sVal) {
            return;
        // Convert string to a number
        nVal = +sVal;
        // Get the values of the fields, as numbers
        var v1 = +getField("text1").value;
        var v2 = +getField("text2").value;
        // Add them together, rounding to two decimal places, converting to number
        var sum = +util.printf("%.2f", v1 + v2);
        // Compare entered value to the sum of the other two fields
        // Alter the user if they do not match
        if (nVal !== sum) {
            app.alert("The value you entered does not equal the sum of text1 and text2. Please correct.", 3);
            // If you want the entered value rejected, include the following
            event.rc = false;
    Replace "text1" and "text2" with the actual field names.

  • How to copy data in text file into two-dimensional arrays?

    Greeting. Can somebody teach me how to copy the input file into two-dimensional arrays? I'm stuck in making a matrix with number ROWS and COLUMNS according to the data in "input.txt"
    import java.io.*;
    import java.util.*;
    public class array
        public static void main (String[] args) throws FileNotFoundException
        { Scanner sc = new Scanner (new FileReader("input.txt"));
            PrintWriter outfile = new PrintWriter("output.txt");
        int[][]matrix = new int[ROWS][COLUMNS];
    }my input.txt :
    a,b,c
    2,2,1
    1,1,1
    2,2,1
    3,3,1
    4,4,1
    5,5,1
    1,6,2
    2,7,2
    3,8,2
    4,9,2
    5,10,2

    import java.io.*;
    import java.util.*;
    public class array {
        public static void main(String[] args) throws IOException {
            FileInputStream in = null;
            FileOutputStream out = null;
    try {
        in = new FileInputStream("input.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = null;
        while ((line = reader.readLine()) != null) {
            String split[]=line.split(",");
    catch (IOException x) {
        System.err.println(x);
    } finally {
        if (in != null) in.close();
    }}}What after this?

  • To add two new fields in CO09 SCREEN

    Hi All,
    I have a requirement of adding two new fields  Customer Name and Number (Sold to party) for the MRP Elements IN CO09 Screen which is already there in MD04.
    Please let me know as soon as possible if any one has any idea regarding this.

    Hi All,
    I have the same issue. Any solution already in sight?
    KR,
    Martin

Maybe you are looking for

  • Project file size

    Is there an easy way to determine what your project file size is before you burn to video. I have 1 hour 15 mins of video which should write Ok to a 4.7Gb dvd but adding the audio seems to take the whole project over the dvd file size limit. is this

  • Need help to write matrix query

    Hi all, I have the query . I'm getting output like this chargetype amount start_date DA1 170 04/01/2005 DA2 1170 04/01/2005 DA3 1730 04/01/2005 DA4 17 04/01/2005 DA5 -120 04/01/2005 DA6 0 04/01/2005 DA1 170 04/02/2005 DA2 2005 04/02/2005 DA3 590 04/0

  • SharePoint 2013 - Split comma separated Column in to different row items in SharePoint 2013 Workflow or Event Handler

    I have a requirement to take a String column that allows multiple fields i.e. "101;102,103,104", and using a SPD 2013 workflow I want to split there values and then insert each Values into different list as separate items. Eg: I have a LIST A with th

  • How to show auto finish( complete) bubble ?

    I am not sure if bubble is the correct term. Users requested if there is a way to mimic MS Access when entering data in the form if the same data has been entered previously, Access will display the previous typed data in a bubble (?) after couple st

  • Why is it showing this error

    Here is the code: import java.sql.*; import javax.sql.*; import java.util.*; import javax.ejb.*; import javax.naming.*; public class sngEJB implements EntityBean           private String songID;           private String category;           private St