Using array as a dataprovider for combobox

Hi folks, I would apreciate some help.
I have a multi dimentional array as per
_dbNames[0]=["Initialize User","","",""];
How can assign an array like this as a dataprovider to a
combobox using actionscript 3?
Thanks for for the help!!

Hey Jarno, 
I did some playing around with this (sorry for the delay) and another workaround we can use is adding an Always Copy to the array before passing it into the Script Node. This will allow you to continue using Double precision arrays instead of going to Singles.
It looks like there is an issue with the array copy that is passed into the SubVI through the terminal, but we can get around it by making a new copy that the Script Node can properly work with. 
Tim A.
National Instruments

Similar Messages

  • Formatting textfile for Combobox.dataProvider

    Can't seem to find any formatting rules for array
    construction through an external file.
    This is what i am trying to do:
    I've loaded vars into the _root this works fine. Splitted its
    value for constructing an array. This seems to work fine aswell.
    If I code the array within the fla in this format:
    my_dP= new Array(
    {label:"choose..."},
    {data:"
    http://www.myserver.com/netlabel/Johannes
    Lauxen.txt",label:"Johanes Lauxen"},
    {data:"
    http://www.myserver.com/netlabel/PQR1.txt",
    label:"PQR1"}
    and use this for the dataProvider for the combobox named
    my_cb like this:
    my_cb.dataProvider = my_dP;
    everything works fine.
    The problem is:
    But if I put this in the same formatting in the textfile for
    the array I create using split like I described above, the values
    for my labels in my_cb are this text, i mean it doesn't
    interpretate the loaded text as script, it just displays the code
    as labels.
    my textfile looks like this :
    &var2={label:"choose..."}#{data:"
    http://www.myserver.com/netla
    bel/Johannes Lauxen.txt",label:"Johanes
    Lauxen"}#{data:"
    http://www.myserver.com/netlabel/PQR1.txt",
    label:"PQR1"}&
    (O, the # is used for delimiter)
    How can i get this to work ? Or is it not the
    textfileformatting that causes the problem ?
    many thanks
    (flash8 b.t.w.)

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="450" height="350">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                [Bindable]
                private var types:Array = ['colors','numbers','shapes'];
                private var dataProviders:Object =
                    colors:['red','blue','green'],
                    numbers:['1','2','3'],
                    shapes:['circle', 'square','triangle']
                private function getItemDataProvider(type:Object):Array
                    return dataProviders[type] as Array;
            ]]>
        </mx:Script>
            <mx:ComboBox id="typeSelector" dataProvider="{types}"/>
            <mx:ComboBox id="itemSelector" dataProvider="{getItemDataProvider(typeSelector.selectedItem)}"/>
    </mx:Application>

  • Using xml as dataProvider for chart

    I am trying to use a loaded xml as the dataProvider for a pie chart like this
    <mx:PieChart id="pieChart"
                         dataProvider="{get_xml.lastResult.AssetAllocationFunds.fund[0].target_allocation}">
    This works, but gives a warning that
    "Data binding will not be able to detect changes when using the square bracket operator. For Array, please use ArrayCollection.getItemAt() instead."
    Can someone give me some direction on how to implement this.
    Thanks.

    So that solution I posted up wasn't going to work for what I needed.
    Basically, the "itemRollOver" and "itemClick" that work for the pie chart when hard coded on the main application don't work when embedded in a custom class that extends the PieChart. I haven't been able to figure out why.
    However, I did get the syntax for targeting ArrayCollection.getItemAt() worked out.
    Here is a simple example.
    Hope it helps others.
    Mark
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:s="library://ns.adobe.com/flex/spark"
        >
        <fx:Script>
            <![CDATA[
                import mx.charts.events.ChartEvent;
                import mx.charts.events.ChartItemEvent;
                import mx.charts.series.items.PieSeriesItem;
                import mx.collections.ArrayCollection;
                import mx.events.FlexEvent;
                import mx.rpc.events.ResultEvent;
                import mx.charts.series.PieSeries;
                private function pieChart_itemRoll(evt:ChartItemEvent):void {
                    var psi:PieSeriesItem = evt.hitData.chartItem as PieSeriesItem;
                    myTextArea.text += "\rtarget: "+psi.item.target;
                    trace(psi.item.target);
                private function pieChartClick(event:ChartItemEvent, pieName:String):void{   
                    myTextArea.text += "\rid: "+pieName;
                [Bindable]
                private var chartData:ArrayCollection = new ArrayCollection(
                    [[{target:"Target A0",percent:40},
                        {target:"Target A1",percent:30},
                        {target:"Target A2",percent:20},
                        {target:"Target A3",percent:10}],
                        [{target:"Target B0",percent:45},
                            {target:"Target B1",percent:22},
                            {target:"Target B2",percent:17},
                            {target:"Target B3",percent:8}]]);
            ]]>
        </fx:Script>
        <s:VGroup>
            <s:HGroup id="myGroup">
                <mx:PieChart
                    dataProvider="{chartData.getItemAt(0)}"
                    itemRollOver="pieChart_itemRoll(event);"
                    itemClick="pieChartClick(event, 'pie 0');"
                    showDataTips="false"
                    height="210"
                    width="210">
                    <mx:series>
                        <mx:PieSeries
                            field="percent"
                            nameField="target"
                            labelPosition="inside"
                            >
                        </mx:PieSeries>
                    </mx:series>
                </mx:PieChart>
                <mx:PieChart
                    dataProvider="{chartData.getItemAt(1)}"
                    itemRollOver="pieChart_itemRoll(event);"
                    itemClick="pieChartClick(event, 'pie 1');"
                    showDataTips="false"
                    height="210"
                    width="210">
                    <mx:series>
                        <mx:PieSeries
                            field="percent"
                            nameField="target"
                            labelPosition="inside"
                            >
                        </mx:PieSeries>
                    </mx:series>
                </mx:PieChart>
            </s:HGroup>
            <s:TextArea id="myTextArea"  width="550" height="220" />
        </s:VGroup>
    </s:Application>

  • Using while loops instead of for loops in arrays?

    I am new to java and doing a java tutorial on using arrays and for loops. What im trying to find out is how it is possible to use a while loop instead.
    I would be very grateful if anyone can suggest a way of changing my code to use a while loop.
    The code I have written is:
    public class DetermineGrade
    public static void main(String[]args)
    final char[] mark = {'A','B' ,'C' ,'D' ,'F' };
    char [] grade = new char[5];
    int [] Score ={95,35,65,75};
    for (int i=0; i<4; i++)
    if (Score >= 90)
    grade= mark[0] ;
    else if (Score >=80)
    grade = mark[1] ;
    else if (Score >=70)
    grade = mark[2] ;
    else if (Score >=60)
    grade = mark[3];
    else grade = mark[4];
    for (int i=0; i<4; i++)
    System.out.println("grade = " + Score + ", " + grade);
    Thankyou LB

    Im trying to underdstand the differences in the
    different loops. I can grasp the for loop but I dont
    see how a while loop works, or how it id different
    from the other?
    for (j = INIT; j < MAX; j++) {
        // do stuff
    }is the same as
    j = INIT;
    while (j < MAX) {
        // do stuff
        j++;
    }Lee

  • Use column in 2d array as page number for 3d array

    I have a 2D array coming from a database containing (I simplify a bit for this example)
    column 0: plot number
    column 1: x values
    column 2: corresponding y values
    to be able to process everything and later put it in a graph, i would like to convert it into a 3d array where the page number is the plot number (so column 0) from my original array. I tried two different approaches you can see in the attachment, both give unwanted results:
    1. the resulting array contains two pages with only x2 and y2 for each plot
    2. the resulting array contains two pages with only x1 and y1 for each plot
    What am i doing wrong here?
    As a second difficulty the order in the example 2d array is logical (x1 of plot 1, x1 of plot 2, x2 of plot1.....) .
    The order in the actual array might just as well be as the example in the second attachment
    Thanks!
    Attachments:
    bad order.PNG ‏2 KB
    Move column to page.PNG ‏18 KB

    Attached (LV 8.0) is something I quickly whipped up using the above 2 assumptions as being true. I did not fully test this, so be sure to put it through its paces.
    Your solutions centered on using Insert Into Array. The reason this won't work is because your first x/y pair could be from plot 1 (the second page). But, you cannot insert a second page into an empty array.  I opted for pre-creating the 3D array and then using Replace Array Subset. 
    OK, I posted this before I got the notification that you answered my questions. Given that, then how is one supposed to know the order of the X/Y pairs? Obviously, your example used strings for demonstration. Presumably the real values will be numbers. In this case, how is one supposed to know where to place the new X/Y pair?
    Corollary: Arrays must be rectangular. This means that if plot 0 has 3 XY pairs, but plot 1 has 5, then the 3D array MUST have 5 rows for each page. This means you will have empty rows on page 0. Given this, you are better off creating an array of clusters. Each cluster would contain your XY pairs as a 2D array, and each one can have different number of rows, as shown in this figure:
    Message Edited by smercurio_fc on 03-11-2009 10:43 AM
    Attachments:
    2D Array to 3D Array.vi ‏17 KB
    Example_VI_FP.png ‏5 KB

  • Flex 3 rowCount thing for combobox happen in flex 4

    I can't find a way to have the flex 3 rowCount thing for combobox happen in flex 4. I tried this:
    <s:ComboBox id="cb" width="240">
                    <s:layout>
                        <s:VerticalLayout requestedRowCount="25" >
                        </s:VerticalLayout>
    but no change

    Heres a skin you could try for the cb lol
    <?xml version="1.0" encoding="utf-8"?>
    <!--
    ADOBE SYSTEMS INCORPORATED
    Copyright 2008 Adobe Systems Incorporated
    All Rights Reserved.
    NOTICE: Adobe permits you to use, modify, and distribute this file
    in accordance with the terms of the license agreement accompanying it.
    -->
    <!--- The default skin class for the Spark DropDownList component.
    The skin for the anchor button for a DropDownList component
    is defined by the DropDownListButtonSkin class.
    <p>In a custom skin class that uses transitions, set the
    <code>itemDestructionPolicy</code> property to <code>none</code>
    for the PopUpAnchor defined by the popUp property.</p>    
    @see spark.components.DropDownList       
    @see spark.skins.spark.DropDownListButtonSkin
    @langversion 3.0
    @playerversion Flash 10
    @playerversion AIR 1.5
    @productversion Flex 4
    -->
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
                 xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled=".5">
        <!-- host component -->
        <fx:Metadata>
            <![CDATA[
            * @copy spark.skins.spark.ApplicationSkin#hostComponent
            [HostComponent("spark.components.DropDownList")]
            ]]>
        </fx:Metadata>
        <fx:Script fb:purpose="styling">
            <![CDATA[           
                /* Define the content fill items that should be colored by the "contentBackgroundColor" style. */
            //    static private const contentFill:Array = ["bgFill"];
                 * @private
            //    override public function get contentItems():Array {return contentFill};
                 * @private
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                    if (getStyle("borderVisible") == false)
                        if (border)
                            border.visible = false;
                        if (background)
                            background.left = background.top = background.right = background.bottom = 0;
                        if (scroller)
                            scroller.minViewportInset = 0;
                    else
                        if (border)
                            border.visible = true;
                        if (background)
                            background.left = background.top = background.right = background.bottom = 1;
                        if (scroller)
                            scroller.minViewportInset = 1;
                    if (dropShadow)
                        dropShadow.visible = getStyle("dropShadowVisible");
                    openButton.setStyle("cornerRadius", getStyle("cornerRadius"));
                    if (borderStroke)
                        borderStroke.color = getStyle("borderColor");
                        borderStroke.alpha = getStyle("borderAlpha");
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="normal" />
            <s:State name="open" />
            <s:State name="disabled" />
        </s:states>
        <!---
        The PopUpAnchor control that opens the drop-down list.
        <p>In a custom skin class that uses transitions, set the
        <code>itemDestructionPolicy</code> property to <code>none</code>.</p>
        -->
        <s:PopUpAnchor id="popUp"  displayPopUp.normal="false" displayPopUp.open="true" includeIn="open"
                       left="0" right="0" top="0" bottom="0" itemDestructionPolicy="auto"
                       popUpPosition="below" popUpWidthMatchesAnchorWidth="true">
            <!---
            This includes borders, background colors, scrollers, and filters.
            @copy spark.components.supportClasses.DropDownListBase#dropDown
            -->
            <s:Group id="dropDown" maxHeight="800" minHeight="22" >
                <!--- @private -->
                <s:RectangularDropShadow id="dropShadow" blurX="20" blurY="20" alpha="0.45" distance="7"
                                         angle="90" color="#000000" left="0" top="0" right="0" bottom="0"/>
                <!--- @private -->
                <s:Rect id="border" left="0" right="0" top="0" bottom="0">
                    <s:stroke>
                        <!--- border stroke @private -->
                        <s:SolidColorStroke id="borderStroke" weight="1"/>
                    </s:stroke>
                </s:Rect>
                <!-- fill -->
                <!--- Defines the appearance of drop-down list's background fill. -->
                <s:Rect id="background" left="1" right="1" top="1" bottom="1" >
                    <!--    <s:SolidColor id="bgFill" color="0xFFFFFF" />-->
                    <s:stroke>
                        <s:SolidColorStroke color="#555555" />
                    </s:stroke>
                    <s:fill >
                        <s:LinearGradient rotation="75" >
                            <s:GradientEntry color="0x0e47a5"  />
                            <s:GradientEntry color="0x27c1f4" />
                            <s:GradientEntry color="0x0e47a5" />
                        </s:LinearGradient>
                    </s:fill>  
                </s:Rect>
                <!--- @private -->
                <s:Scroller id="scroller" left="0" top="0" right="0" bottom="0" hasFocusableChildren="false" minViewportInset="1">
                    <!--- @copy spark.components.SkinnableDataContainer#dataGroup-->
                    <s:DataGroup id="dataGroup" itemRenderer="spark.skins.spark.DefaultItemRenderer">
                        <s:layout>
                            <s:VerticalLayout gap="0" horizontalAlign="contentJustify" requestedRowCount="15"/>
                        </s:layout>
                    </s:DataGroup>
                </s:Scroller>
            </s:Group>
        </s:PopUpAnchor>
        <!---  The default skin is DropDownListButtonSkin.
        @copy spark.components.supportClasses.DropDownListBase#openButton
        @see spark.skins.spark.DropDownListButtonSkin -->
        <s:Button id="openButton" left="0" right="0" top="0" bottom="0" focusEnabled="false"
                  skinClass="spark.skins.spark.DropDownListButtonSkin" /> 
        <!--- @copy spark.components.DropDownList#labelDisplay -->
        <s:Label id="labelDisplay" verticalAlign="middle" maxDisplayedLines="1"
                 mouseEnabled="false" mouseChildren="false"
                 left="7" right="30" top="2" bottom="2" width="75" verticalCenter="1" />
    </s:SparkSkin>

  • DataProvider for each DataGridColumn

    Hi, all
    How can I give a dataProvider for each DataGridColumn?
    Because I have an arrayCollection with arrays and each array will
    be assigned to one dataGridColumn. But the problem is the value of
    dataField are the same for all columns, so at the end I only got
    the values from the last array for the whole dataGrid. By the way
    the number of columns depends on the length of the arrayCollection
    and it is dynamic.
    How can I write a custom DataGridColumn for it?
    Anybody got any ideas?
    Thank you very much.

    I'm pasting the code I used. That's the best I can do for
    you.
    First is the main application:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    private function mouseIn( event:MouseEvent ) : void
    trace("In: target="+event.target+";
    current="+event.currentTarget+"; related="+event.relatedObject);
    if( event.relatedObject == box.parent ) {
    b1.visible = true;
    b2.visible = true;
    private function mouseOut( event:MouseEvent ) : void
    trace("out: target="+event.target+";
    current="+event.currentTarget+"; related="+event.relatedObject);
    if( event.relatedObject == box.parent ) {
    b1.visible = false;
    b2.visible = false;
    [Bindable] private var dp:ArrayCollection = new
    ArrayCollection(
    [ [1,2,3,4], [10,20,30,40], [100,200,300,400] ]);
    ]]>
    </mx:Script>
    <mx:VBox id="box" x="43" y="45" width="300" height="185"
    horizontalAlign="center"
    mouseOver="mouseIn(event)"
    mouseOut="mouseOut(event)"
    backgroundColor="#804040" verticalAlign="middle">
    <mx:Button width="127" height="97" />
    <mx:Button label="Button 1" id="b1" visible="false"/>
    <mx:Button label="Button 2" id="b2" visible="false"/>
    </mx:VBox>
    <mx:DateChooser
    selectableRange="{{rangeStart : new Date(2000,0,1),rangeEnd
    : new Date()}}"
    id="dateChoose" showToday="false"/>
    <mx:DataGrid x="163" y="292" height="179" width="326"
    dataProvider="{dp}">
    <mx:columns>
    <mx:DataGridColumn headerText="Column 1" dataField="col1"
    itemRenderer="components.forums.ArrayItemRenderer"/>
    <mx:DataGridColumn headerText="Column 2" dataField="col2"
    itemRenderer="components.forums.ArrayItemRenderer"/>
    <mx:DataGridColumn headerText="Column 3" dataField="col3"
    itemRenderer="components.forums.ArrayItemRenderer"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    This is the item renderer code:
    package components.forums
    import mx.controls.Text;
    import mx.collections.ArrayCollection;
    import mx.controls.DataGrid;
    public class ArrayItemRenderer extends Text
    public function ArrayItemRenderer()
    super();
    override protected function
    updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    if( data )
    var dp:ArrayCollection = (listData.owner as
    DataGrid).dataProvider as ArrayCollection;
    var colIndex:int = listData.columnIndex;
    var rowIndex:int = listData.rowIndex;
    var colArray:Array = dp.getItemAt(colIndex) as Array;
    text = String(colArray[rowIndex-1]);
    else text = "";
    ----------------------------

  • Applicatoopn root / dynamic dataProvider for itemEditor

    How to reach the main application instance from a custom
    datagrid itemEditor component? I need to use data in the
    application for dataProvider of that ComboBox itemEditor.

    I think you should always be able to do
    Application.application.

  • Checkboxes: How do you use them to select geometries for display, MapViewer

    Dear all
    I am working in Oracle 10.2 and using PL/SQL. I am trying to create a procedure that generates a list of spatial layers, based on those currently contained in the database, which uses checkboxes, so that users can select which layers to display.
    Once the user has made his choices and the results are submitted, the chosen layers are displayed through MapViewer. Currently the procedure, which is still being developed, is as follows:
    PROCEDURE MAPLIST AS
    CURSOR curmaplist IS
      SELECT spatial_map_name
             spatial_map_id
             geom
       FROM spatial_map_table;
      varmaplist curmaplist%ROWTYPE;
       varchecked VARCHAR2(32767);
    BEGIN
    FOR varmaplist in curmaplist LOOP
      htp.print('<FORM>
                  <UL>
                   <LI>
                    <LABEL FOR="SM_ID||
                                curmaplist.spatial_map_id||">
                     <INPUT type="checkbox"
                            id="SM_ID||
                                curmaplist.spatial_map_id||"
                            name="SM_ID||
                                  curmaplist.spatial_map_id||"
                            value="MAP TITLE: ||
                                   curmaplist.spatial_map_name" />
                    </LABEL>
                   </LI>
                  </UL>
                 </FORM>'
      EXIT WHEN curmaplist%NOTFOUND;
       END LOOP;
    END;I am not sure how to incorporate the checked element and then make use of it. Regarding subsequent use, I wondered if an IF statement could be used.
    IF VARCHECKED = 'CHECKED' THEN...after this MapViewer XML is added, with the select statement making use of the cursor. For example:
    select curmaplist.geom
    from geg50160.spatial_map_tableFor the checked part itself, I have found the following Oracle code in Chapter 11 of Oracle Database Application Developer’s Guide - Fundamentals 10.2.
    CREATE OR REPLACE PROCEDURE handle_checkboxes ( checkboxes owa_util.ident_arr )
    AS
    BEGIN
    FOR i IN 1..checkboxes.count
    LOOP
    htp.print('<p>Checkbox value: ' || checkboxes(i));
    END LOOP;
    END;
    /However I am not certain how I would incorporate that into my code. I take it i refers to the checkbox value. I've read that .ident_arr is an array which can hold multiple values but if so I am also not sure why checkboxes are counted.
    Kind regards
    Tim

    Hi GKaiseril,
    Thanks for your reply.  That's what I'm attempting to do, but I'm largely trying to "borrow" on-line JavaScript (see below) & modify for my PDF Form, w/ rudimentary knowledge gained while surfing the web.  The Form has 30 checkboxes that I want to limit users to a max. of 4.
    So any add'l scripting tips would be most appreciated.
    Thanks!
    var NewCount = 0
    getField("Check_Box1").value === "Yes"
    {NewCount = NewCount + 1}
    getField("Check_Box2").value === "Yes"
    {NewCount = NewCount + 1}
    getField("Check_Box3").value === "Yes"
    {NewCount = NewCount + 1}
    getField("Check_Box4").value === "Yes"
    {NewCount = NewCount + 1}
    getField("Check_Box5").value === "Yes"
      {NewCount = NewCount + 1}
    if (NewCount == 4)
    app.alert(“Pick Just Four Please”); return false;

  • Using Native SQL in ABAP for DB2 database

    Dear Friends,
           I have 500K records in ITAB(Internal table) which needs to insert in 'Z' transparent table. Currently it is taking hours of time for insertion and commit. 
    Does using Native SQL helps in performance or any suggestions? If so please send the code. Our database is DB2.
    Your immediate reply is appreciated. Thanks in advance.

    Hi Rama,
    Using array inserts and commit after each Insert, set up your array size as a parameter and try  different array sizes.
    I would start with 2000 and increment by 1000 or 2000 and see what the optimal array size is.
    I would think more commits are desirable, as the array gets bigger it takes longer for the system to prepare in the event of a rollback.
    Just remember to commit after each insert. And are you enqueueing the table first?
    Hope this helps.
    Filler

  • Workaround to use drives with 4096b block for mirrored RAID?

    I have 2 Hitachi 2TB Drives. One is a few months old and uses 512b blocks, the other is the same model, but newer and uses 4096b blocks.
    When I try to set up the RAID Set I get the error: MediaKit reports block size error, usually caused by not being a multiple of 512.
    From reading the message board, it looks like this a known bug when trying to encrypt drives with 4K block sizes or add them to a RAID Array.
    Is there any way to set these up as a mirrored RAID array other than waiting for apple to fix the problem? Are there third party apps that can be used to fix this problem?
    Thank you for your time.

    I have the exact same problem, and until Apple solves this bug, I no longer have a hard drive large enoug for my Time Machine back-ups. I have submitted the bug, but I really need a solution. Please help!

  • Help using arrays in java

    HI all,
    I am working on a program that will print out my initials 'A' and 'T' using arrays. I am asked to initialize the first intial to '*' and the second intial to '@'. I wrote the code but the output is wrong. Can someone help me by letting me know what I am doing wrong in my arrray?I just get back my array of 30X30. I also wrote a driver but when I run the program, I really appreciate it so much.
    public class Initial
         private char whichinitial ;
         private int MAX =30;//Maximum amount for 2-d Matrix
         char[][] letterMatrix = new char[MAX][MAX];//2-d Array 30 x30
         private boolean first = true;
         public Initial()
         { //FIlls Array full of '*'s
              whichinitial = '*';
              for(int i=0;i< MAX;i++)
                   for(int j=0;i< MAX;i++)
                        letterMatrix[i][j] = whichinitial;
         public void setLetter(char letter)
         {//Setter for Letter
               whichinitial = letter;
         public char getLetter()
         {//Getter for Letter
              return whichinitial;
         public void firstLetter()
         { //Creates an A shape
              for(int i=0;i< MAX;i++)
                for(int j=0;j< MAX;j++)
                      if((i>0)|| ((i<6) || ((j>0) && (j<29))))
                         letterMatrix[j] =whichinitial;
         public void secondLetter()
         {//Creates an T shape
              first = false;
                   for(int i=0;i <MAX;i++)
                   for(int j=0;j <MAX;j++)
                        if((i>1) ||(j < 29)||(j>5)||(i>10))
                             letterMatrix[i][j] = whichinitial;
         public void display()
         {//Displays the Initials
              if(first)
                   System.out.println("\n \n \n My First Initial," + whichinitial + ", follows:");
              else
                   System.out.println("\n \n \n My Last Initial," + whichinitial + ", follows:");
                   for(int i=0;i <MAX;i++)
                        System.out.println();
                        for(int j=0;j <MAX;j++)
                             if(letterMatrix[i][j] == '*')
                                  System.out.print(" ");
                             else
                                  System.out.print(letterMatrix[i][j]);

    I am trying to write a program using a matrix. The size of the maxtrix should be 30X30. The first initial shoulld be initialized to '*' and the secind initial should be initialized to '@'. Both initials should be 30 characters high and 30 characters wide and the initials should also represent the uppercase letter of your initials. I know that the first initial's matrix needs to be filled up vertically and the second initial needs to be filled horizontally but the output is wrong....PLease Help!
    Message was edited by:
    apples03

  • Using arrays in apex

    hi i want to know if some can guide me how to use array in apex.
    i have a tabuler report with 4 columns.
    i need to write a validation in the tabuler report for that i need to used array.
    can I directly access the colums as i have shown below? or do i need to decleare this arrays some were in apex?
    e.g
    FOR i IN 1 .. ow_app.g_f01.COUNT
    loop.........................
    LOGIC
    end loop;
    from what i understand i can access each column as ow_app.g_f01,ow_app.g_f02,ow_app.g_f03,ow_app.g_f04 does this make sense?
    thanks a lot.

    Hi user591315 (please tell us your name - we're a friendly group!),
    In answer to this and your previous related post, there is an excellent example of what you're looking to accomplish provided by Denes Kubicek available at http://apex.oracle.com/pls/otn/f?p=31517:41
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • Using Arrays in a program

    First, I would like to thank everyone in this forum for all the help they have given me over the past few weeks. With that said, I am currently trying to alter the following code to accept and use arrays to end to produce three seperate results. The program now as three hard coded variables which are
    Amount = 200000.00;
    Term = 30;
    InterestRate = .0575;
    I need to have the program work the same, but produce results for three different Terms and Three different periods. Below is the code the I am working on, I have added two arrays containing the required information. I am having a hard time coming up with a for statment to move the program through the two arrays. Any pushes in the right direction would be great. I left the hard code variable in place, I know that I do need to remove them and alter the equations. I just thought it would be easier for everyone to understand if I left the code in working form.
    import java.math.*;
    import java.text.*;
    import java.util.*;
    // The Payment class displays a predetermined monthly mortgage payment
    public class Payment
         public static void main(String[]arguments)
              //Creates Two Arrays for InterestRates and Terms
              double[] InterestRates = {.0535, .055, .0575};
              int[] Terms = {7, 15, 30};
              //Creates variables
              double Amount;
              int Term;
              double InterestRate;
              //Assigns values to variables
              Amount = 200000.00;
              Term = 30;
              InterestRate = .0575;
              //Alters the display format of Amount variable
              NumberFormat n = NumberFormat.getCurrencyInstance(Locale.US);
              String s = n.format(Amount);
              //Creates variables
              double MonthlyInterestRate;
              int TotalMonths;
              double Payment;
              //Assigns values to variables
              MonthlyInterestRate = InterestRate / 12;
              TotalMonths = Term * 12;
              Payment = Amount* MonthlyInterestRate / (1-(Math.pow((1+MonthlyInterestRate ),(-TotalMonths))));
              //Takes Payment variable and round answer to 2 decimal points
              BigDecimal bd = new BigDecimal(Payment);
    bd = bd.setScale(2, BigDecimal.ROUND_DOWN);
              //Instructions to display various varibles
              System.out.println("Cost of Mortgage "+ s);
              System.out.println("Length of Term " + Term);
              System.out.println("Interest Rate 5.75% ");
              System.out.println("The monthly payment of this loan is $" + bd);
              System.out.println();
              //Creates new set of variables
              double MonthlyInterest;
              double MonthlyPrincipal;
              double TotalInterestPaid;
              int NumberofPayments;
              //Creates Balance variable
              double Balance;
              //Initialization of Balance variable
              Balance = 200000;
              TotalInterestPaid = 0;
              NumberofPayments = 360;
              //Creates a loop that calculates the entire term of loan
              do
              MonthlyInterest = Balance * (InterestRate / 12);
              MonthlyPrincipal = Payment - MonthlyInterest;
              Balance = Balance - MonthlyPrincipal;
              TotalInterestPaid = TotalInterestPaid + MonthlyInterest;
              NumberofPayments = NumberofPayments - 1;
              //Takes current balance and rounds the answer to two digits
              BigDecimal bb = new BigDecimal(Balance);
    bb = bb.setScale(2, BigDecimal.ROUND_DOWN);
              BigDecimal tip = new BigDecimal(TotalInterestPaid);
                        tip = tip.setScale(2, BigDecimal.ROUND_UP);
              System.out.println("New Loan Balance " + bb);
              System.out.println();
              System.out.println("Total Interest Paid " + tip);
              System.out.println();
              System.out.println("Number of Payments remaining " + NumberofPayments);
              System.out.println();
              //The following lines of code pauses the loop to allow the user to read the output
              //The speed of th display can be adujusted to a wide variety of speeds
              try
                   Thread.sleep(400);
                   catch (InterruptedException exc)
              //Loop condition
              while (NumberofPayments > 0);
    //Ends Application

    Try this. It should give you some ideas. :)
    import java.math.BigDecimal;
    import java.text.NumberFormat;
    import java.util.Locale;
    // The Payment class displays a predetermined monthly mortgage payment
    public class Payment {
        public static final NumberFormat CURRENCY_FORMAT = NumberFormat.getCurrencyInstance(Locale.US);
        public static final double[] INTEREST_RATES = {.0535D, .055D, .0575D};
        public static final int[] TERMS = {7, 15, 30};
        public static final double AMOUNT = 200000.00;
        public static final int MONTHS_PER_YEAR = 12;
        public static void main(String[] arguments) {
            for (int t = 0; t < TERMS.length; t++) {
                for (int i = 0; i < INTEREST_RATES.length; i++) {
                    displayPayments(AMOUNT, INTEREST_RATES, TERMS[t]);
    private static void displayPayments(double amount, double interestRate, int term) {
    //Creates variables
    //Assigns values to variables
    double monthlyInterestRate = interestRate / MONTHS_PER_YEAR;
    int totalMonths = term * MONTHS_PER_YEAR;
    double payment = amount * monthlyInterestRate / (1 - Math.pow(1 + monthlyInterestRate, -totalMonths));
    //Instructions to display various varibles
    System.out.println("Cost of Mortgage " + CURRENCY_FORMAT.format(amount));
    System.out.println("Length of Term " + term);
    System.out.println("Interest Rate " + new BigDecimal(interestRate * 100).setScale(2, BigDecimal.ROUND_HALF_UP) + '%');
    System.out.println("The monthly payment of this loan is " + CURRENCY_FORMAT.format(payment));
    System.out.println();
    //Creates new set of variables
    double totalInterestPaid = 0.0D;
    //Creates balance variable, Initialization of balance variable
    double balance = amount;
    //Creates a loop that calculates the entire term of loan
    System.out.println("New Loan balance, Total Interest Paid, Number of Payments remaining");
    for (int numberofPayment = totalMonths; numberofPayment > 0; numberofPayment--) {
    double monthlyInterest = balance * monthlyInterestRate;
    double monthlyPrincipal = payment - monthlyInterest;
    balance -= monthlyPrincipal;
    totalInterestPaid += monthlyInterest;
    //Takes current balance and rounds the answer to two digits
    BigDecimal bb = new BigDecimal(balance);
    bb = bb.setScale(2, BigDecimal.ROUND_DOWN);
    BigDecimal tip = new BigDecimal(totalInterestPaid);
    tip = tip.setScale(2, BigDecimal.ROUND_UP);
    System.out.println(CURRENCY_FORMAT.format(bb.doubleValue()) + ", " +
    CURRENCY_FORMAT.format(tip.doubleValue()) + ", " +
    numberofPayment);
    System.out.println();
    //Ends Application

  • Using arrays in forms

    Hi All!
    Anybody know how to use Arrays in Forms 6?
    Best regards.

    Hello,
    have you tried collections ?
    Declare
       TYPE  TYP_NUM_ARRAY IS TABLE OF NUMBER INDEX BY BINARY_INTEGER ;
       mytab TYP_NUM_ARRAY ;
    Begin
       For i IN 1..10 Loop
          mytab(i) := i ;
       End loop ;
    End ;Francois

Maybe you are looking for