Output integer loop

I'd like to create a sub VI that uses a for loop to spit out an integer. I want to set up a handful of boolean controls, each corresponding to an integer (say 1, 2, 3). When none are true, the output of the sub VI is 0, and when one of the controls is switched to true, the output will be 1, 2, or 3. Any suggestions?

One possibility is to use radio buttons.
Another ...
Attachments:
Example_VI_BD.png ‏12 KB

Similar Messages

  • Frequency problem in input-output control loop, LabviewRT

    Hello,
    I want to write a cotrol loop in LabView real-time. My target is to acquire a data from 5 channel in frequncy about 100 kHz, integrate the data and send them to the output in frequency about 10 kHz (every 10th sample). I made twou time-loops. One for acquiring and integrating, second for sending them to output. This loops are connected throug the rt fifo. 
    My problem is with a speed of acquisition. When I use "Hardware-timed single point" for acquiring, the result frequency is about 50 kHz. Continous sample and finite samples give me the desired frequency, but the output is not in in the same time as input (output waits until the input collects all data). Is there any problem with communication with the input and output channels in the same time?
    My Hardware: 
    Computer: NI PXIe-8108 in NI PXIe-1062Q
    card: NI PXIe-6358
    My vi is attached
    Attachments:
    rt_headless_v1.2.vi ‏133 KB

    Dear Kocman,
    thanks for including your VI, it is useful to understand better your application.
    However, the detailed requirements are still not entirely clear for me.
    I think, starting with the right architecture and proper timing and synchronization schemes could save you a lot of effort while they ensure proper operation.
    First, it should be defined what kind of timing your application requires. More specifically, if it needs to be hardware or software timed.
    From your description it sounds like you would need hardware timed aquisition synchronized with generation, although your code tries to implement it using timed loops, which are inherently software timed.
    You can find some useful additional information about the two methods and a nice white paper about synchronization techniques here:
    http://zone.ni.com/reference/en-XX/help/370466V-01/TOC11.htm
    http://www.ni.com/white-paper/4322/en
    Probably it helps to review them or even try to test some of the methods to get a better feeling about it.
    I hope this helps you to get to the proper solution.
    Best Regards,
    Adam Cseh
    Applications/Systems Engineer
    National Instruments

  • How do I change the output the loops come out of?

    My tracks are set for outputs 3-4 and they are coming out fine through my audio interface, but I can't sample the loops unless I disconnect my interface or drag them onto a track. Can I change the loop output to 3-4? It used to work fine.

    Jade Falco wrote:
    My tracks are set for outputs 3-4 and they are coming out fine through my audio interface, but I can't sample the loops unless I disconnect my interface or drag them onto a track. Can I change the loop output to 3-4? It used to work fine.
    Hi Jade,
    I noticed from your two posts, that you use outputs 3-4 as your Main outputs.
    Is there a very important reason why you do this? I only question this decision because 99% of all DAWs use outputs 1-2 as the Main outputs.
    Logic Pro is just such one application that does so.
    As far as your actual question, if you are playing the loops from Logic, and you want to process them in real time (filter, EQ, etc using a controlller to change it in realtime as you record the results), and re-record them into Logic, you can now do so using internal busses. Please read up in the manual about this new feature.
    I highly recommend you use your hardware's outputs 1-2 as the Main outputs for Logic, it will make your life easier. And when you go to other studios, your sessions will be compatible most of the time, saving you time and money by not having to change your audio routing every time.
    Cheers

  • JSTL HTML output when looping

    Hi,
    I am creating tables dynamically using JSTL. My problem is, the HTML that comes out has lots of blank space. This may sound insignificant but it makes it very hard to see what's going on when I view the source of a page.
    JSP:
         <c:forEach items="${holidaybean.monthview }" var="usermonth">
              <tr>
                   <td>
                         <a href="staffholiday.jsp?useremail=${usermonth.email}"><c:out value="${usermonth.firstname} ${usermonth.surname }"></c:out>  </a>
                  </td>
                   <c:forEach items="${usermonth.leave}" var="day">
                        <c:choose>
                             <c:when test="${day == -3 }">
                                  <c:set var="color" value="#00FF00"></c:set>
                             </c:when>
                             <c:when test="${day == -2 }">
                                  <c:set var="color" value="#BDBABD"></c:set>
                             </c:when>
                             <c:when test="${day == -1 }">
                                  <c:set var="color" value="#FFFFDD"></c:set>
                             </c:when>
                             <c:when test="${day == 0 }">
                                  <c:set var="color" value="#940000"></c:set>
                             </c:when>
                             <c:when test="${day == 2 }">
                                  <c:set var="color" value="#3399FF"></c:set>
                             </c:when>
                             <c:when test="${day == 5 }">
                                  <c:set var="color" value="#000000"></c:set>
                             </c:when>
                             <c:otherwise>
                                  <c:set var="color" value="#FFFF00"></c:set>
                             </c:otherwise>
                        </c:choose>
                        <td class="monthviewDateColumn" align="center" width="3%" bgcolor="${color }"></td>
                   </c:forEach>
              </tr>
         </c:forEach>Output HTML:
    <tr>
                   <td>
                         <a href="[email protected]                                                                         ">Olivier                                            Lewis                                               </a>
                  </td>
                        <td class="monthviewDateColumn" align="center" width="3%" bgcolor="#BDBABD"></td>
                        <td class="monthviewDateColumn" align="center" width="3%" bgcolor="#FFFFDD"></td>
    blah blah blah
    <td class="monthviewDateColumn" align="center" width="3%" bgcolor="#FFFFDD"></td>
                        <td class="monthviewDateColumn" align="center" width="3%" bgcolor="#BDBABD"></td>
              </tr>

    Depends on the appserver (the actual JSP/Servlet implementation) used. If you're using an appserver which uses the Apache JspServlet (e.g. Apache Tomcat, JBoss AS, WebSphere, etc), then you can trim the whitespace by the following JspServlet init-param in appserver's web.xml (which is in for example Tomcat located at Tomcat/conf/web.xml):
    <servlet>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>trimSpaces</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>If not, then best is to just consult the appserver's documentation using keywords like "trim", "whitespace", etc.
    By the way, don't you see a repeating pattern in your code? The c:choose can be removed if you have a mapping of day-color values.
    <td class="monthviewDateColumn" align="center" width="3%" bgcolor="${colors[day]}"></td>Where ${colors} should be a Map<Long, String> which you put in session or application scope.

  • Incrementing Ascii and integer loop

    Hi there,
    Just wondering if anybody can help me with this little problem that I have... I'm trying to write a loop that increments ascii and integers. It should look something like this:
    0 1 2 3 4 5 6 7 8 9 A B C D ..... X Y Z 00 01 02..... 0A 0B 0C .... 0Z 10 11 .... ABCD1 and so on...
    I got the loop bits but I don't know what I can do to combine the 2...
             for (char x= 'A'; x <= 'Z'; x++)
                   System.out.println("Count is:" + x);
             for(int i=1; i<11; i++){
                   System.out.println("Count is: " + i);Can anybody give me some tips please? Thanks in advance!

    you can do this you know
    for(int i=0,char a='a';i<11,a<='z';i++,z++)and then print whatever you want to

  • Looping part of 6534 output buffer

    I need to loop a 16 bit output pattern that is only 1000 samples long. I want to loop this continuously but do not want to have to fill the buffer completely. Is it possible to loop only these 1000 samples in the buffer?

    Coxy,
    Yes, this is definitely possible. You don't need to fill the board's memory to perform onboard looping. Below, I have included links to a couple of example programs that you may want to examine:
    LabVIEW Example
    Continuously Generating Repeat Data from Digital Output Channels (Loop From Onboard Memory)
    NI-DAQ Function Calls Example
    Pattern Generation with Onboard Looping for the NI 6534 and C++
    Good luck with your application.
    Spencer S.

  • Apple Loops - How do you change the monitoring output?

    Anyone know how to change the default output of the Apple Loop player to another output (eg. 5-6), or is this just wishful thinking?

    Very easy. Go to the mixer tab, and select the ALL button at the top of that window. You should see a channel strip called Prelisten, usually on audio channel 256. Change that output to whatever, and that will change the monitoring output for loops, the bin, and the Sample Editor.

  • New to Graphics, trying to display array output in a single window

    I am trying to figure out how to use the GUI components of JAVA.
    What I am trying to do is take my packaged array output and list it in a single window. All that ever prints is last array data set. The last keeps overwritting the previous. How do I keep the previous data shown while listing the next in the array?
    Below are my three classes. The Frame Class is the class containing the display method. It is called near the bottom of the Product Class.
    Product.java
    // Inventory Program Part 4
    /* This program will store multiple entries
    for office supplies, give the inventory value,
    sort the data by Product Name,
    and output the results using a GUI */
    import javax.swing.text.JTextComponent;
    import javax.swing.JLabel;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JOptionPane; //Uses class JOptionPane
    import java.util.Scanner; //Uses class Scanner
    import java.util.Arrays; //Uses class Arrays
    public class Product
         private String productBrand[]; // Declares the array
         public void setProductBrand( String brand[] ) // Declare setProductBrand method
              productBrand = brand; // stores the productbrand
         } // End setProductBrand method
         public String getProductBrand( int counter )  // Declares getProductBrand method
              return productBrand[ counter ]; // Returns data using counter to define the element
         } // End method getProductBrand
         public double restockingFee( double value ) // Declares restocking Fee method
              double fee = 0; // Declares variable fee
              fee = value * 0.05; // Calculates the sum of values
              return fee;  // Returns the restocking fee
         } // End method restockingFee     
         public String inventoryValue( double value[] , int number, String name[] ) // Declares inventoryValue method
              OfficeSupplies myOfficeSupplies = new OfficeSupplies();  //Creates OfficeSupplies Object
              Product myProduct = new Product();
              double total = 0; // Declares variable total
              for ( int counter = 0; counter < number ; counter++ )
                   total += ( value[ counter ] + myProduct.restockingFee( value[ counter ] ) ); // Calculates the sum of values
                        return String.format( "%s$%.2f", "Total Inventory Value: " , total );  // Returns the total value
         } // End method inventoryValue
         // main method begins execution
         public static void main( String args[] )
              Scanner input = new Scanner( System.in ); //Creates Scanner object to input from command window
              Product myProduct = new Product(); //Creates Product object
              OfficeSupplies myOfficeSupplies = new OfficeSupplies();  //Creates OfficeSupplies Object          
              //Prompt for maxNumber using JOptionPane
              String stringMaxNumber =
                   JOptionPane.showInputDialog( "Enter the number of products you wish to enter" );
              int maxNumber = Integer.parseInt( stringMaxNumber );     
              String prodName[] = new String[ maxNumber ]; // Declares prodName array
              int numberUnits[] = new int[ maxNumber ]; // Declares maxNumber array          
              float unitPrice[] = new float[ maxNumber ]; // Declares unitPrice array
              double value[] = new double[ maxNumber ]; // Declares value array
              String brand[] = new String [ maxNumber ]; // Declares brand array
              String stringNumberUnits[] = new String [ maxNumber]; // Declares array
              String stringUnitPrice[] = new String [ maxNumber ]; // Declares array
              int productNumber[] = new int[ maxNumber ]; // Declares array
              for ( int counter = 0; counter < maxNumber; counter++ ) // For loop for the number of products to enter
                   productNumber[ counter ] = counter;
                   myOfficeSupplies.setProductNumber( productNumber ); // Sends the Product name to method setProductNumber                         
                   //Prompt for product name using JOptionPane
                   prodName[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Product Name" );
                   myOfficeSupplies.setProductName( prodName ); // Sends the Product name to method setProductName
                   //Prompt for brand name using JOptionPane
                   brand[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Brand name of the Product" );
                   myProduct.setProductBrand( brand ); // Sends the Brand name to method setProductBrand
                   //Prompt for number of units using JOptionPane
                   stringNumberUnits[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Number of Units" );
                   numberUnits[ counter ] = Integer.parseInt( stringNumberUnits[ counter ] );
                   myOfficeSupplies.setNumberUnits( numberUnits ); // Sends the Number Units to the method setNumberUnits
                   //Prompt for unit price using JOptionPane
                   stringUnitPrice[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Unit Price" );
                   unitPrice[ counter ] = Float.parseFloat( stringUnitPrice[ counter ]);
                   myOfficeSupplies.setUnitPrice( unitPrice ); // Sends the Unit Price to the method setUnitPrice
                   value[ counter ] = numberUnits[ counter ] * unitPrice[ counter ]; // Calculates value for each item
                   myOfficeSupplies.setProductValue( value ); // Sends the product value to the method setProductValue
              Arrays.sort( prodName, String.CASE_INSENSITIVE_ORDER ); // Calls method sort from Class Arrays
                   Frame myFrame = new Frame();
                   myFrame.displayData( myProduct, myOfficeSupplies, maxNumber );
              // Outputs Total Inventory Value using a message dialog box
              JOptionPane.showMessageDialog( null, myProduct.inventoryValue( value, maxNumber, prodName ),
                   "Total Inventory Value", JOptionPane.PLAIN_MESSAGE );
         } // End method main
    } // end class ProductOfficeSupplies.java ----> This is the data container
    // Inventory Program Part 4
    /* Stores the array values */
    public class OfficeSupplies // Declaration for class Payroll
         private int productNumber[];
         public void setProductNumber( int number[] ) // Declare setProductNumber method
              productNumber = number; // stores the product number
         } // End setProductNumber method
         public int getProductNumber( int counter )  // Declares getProductNumber method
              return productNumber[ counter ];
         } // End method getProductNumber
         private String productName[];
         public void setProductName( String name[] ) // Declare setProductName method
              productName = name; // stores the Product name
         } // End setProductName method
         public String getProductName( int counter )  // Declares getProductName method
              return productName[ counter ];
         } // End method getProductName
         private int numberUnits[];
         public void setNumberUnits( int units[] ) // Declare setNumberUnits method
              numberUnits = units; // stores the number of units
         } // End setNumberUnits method
         public int getNumberUnits( int counter )  // Declares getNumberUnits method
              return numberUnits[ counter ];
         } // End method getNumberUnits
         private float unitPrice[];
         public void setUnitPrice( float price[] ) // Declare setUnitPrice method
              unitPrice = price; // stores the unit price
         } // End setUnitPrice method
         public float getUnitPrice( int counter )  // Declares getUnitPrice method
              return unitPrice [ counter ];
         } // End method getUnitPrice
         private double productValue[];
         public void setProductValue( double value[] ) // Declare setProductValue method
              productValue = value; // stores the product value
         } // End setProductValue method
         public double getProductValue( int counter )  // Declares getProductValue method
              return productValue[ counter ];
         } // End method getProductValue
    } // end class OfficeSuppliesFrame.java ------> Contains the display method
    import java.awt.Color;
    import javax.swing.text.JTextComponent;
    import javax.swing.JLabel;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JOptionPane; //Uses class JOptionPane
    public class Frame extends JFrame
         public Frame() //Method declaration
              super( "Products" );
         } // end frame constructor
         public void displayData( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
              //Here I attempted to use an array to output all of the array data in a single window
    //          JTextArea myTextArea[] = new JTextArea[ maxNumber ]; // Declares myTextArea array to display output
              JTextArea myTextArea = new JTextArea(); // textarea to display output
              // For loop to display data array in a single Window
              for ( int counter = 0; counter < maxNumber; counter++ )  // Loop for displaying each product
    //               myTextArea[ counter ].setText( packageData( myProduct, myOfficeSupplies, counter ) + "\n" );
    //                add( myTextArea[ counter ] ); // add textarea to JFrame
                   myTextArea.setText( packageData( myProduct, myOfficeSupplies, counter ) + "\n" );
                   add( myTextArea ); // add textarea to JFrame
              } // End For Loop
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              setSize( 450, maxNumber*400 ); // set frame size
              setVisible( true ); // display frame
         public String packageData( Product myProduct, OfficeSupplies myOfficeSupplies, int counter ) // Method for formatting output
              return String.format( "%s: %d\n%s: %s\n%s: %s\n%s: %s\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f",
              "Product Number", myOfficeSupplies.getProductNumber( counter ),
              "Product Name", myOfficeSupplies.getProductName( counter ),
              "Product Brand",myProduct.getProductBrand( counter ),
              "Number of Units in stock", myOfficeSupplies.getNumberUnits( counter ),
              "Price per Unit", myOfficeSupplies.getUnitPrice( counter ),
              "Total Value of Item in Stock is", myOfficeSupplies.getProductValue( counter ),
              "Restock charge this product is", myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ),
              "Total Value of Inventory plus restocking fee", myOfficeSupplies.getProductValue( counter )+
                   myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ) );
         } // end method packageData
    }

    Lets pretend that your assignment was to manage a list of employees of a store, and that each employee is identified by their name, position, and hourly wage. If you created a program along the lines of your current product program, I picture you creating three separate ArrayLists (or arrays), one for each variable, something like this:
    import java.util.ArrayList;
    public class MyEmployees1
        private ArrayList<String> names = new ArrayList<String>();
        private ArrayList<String> positions = new ArrayList<String>();
        private ArrayList<Double> hourlyWages = new ArrayList<Double>();
        public void add(String name, String position, double wage)
            names.add(name);
            positions.add( position);
            hourlyWages.add(wage);
        public void removed()
            // TODO: I am nervous about trying to manage this!
        //.......... more
    }This program tries to manage three separate parallel arrays (arraylists actually). They are parallel because the 3rd item in the names list corresponds to the 3rd item in the positions list and also the hourlywages list. If I wanted to delete data, I'd have to be very careful to delete the correct item in all three lists. If I tried to sort one list, I'd have to sort the other two in exactly the same way. It is extremely easy to mess this sort of program up.
    Now lets look at a different approach. Say we created a MyEmployee class that contains the employee's name, position, and wage, along with the appropriate constructors, getters, setters, toString method, etc... something like so:
    import java.text.NumberFormat;
    public class MyEmployee
        private String name;
        private String position;
        private double hourlyWage;
        public MyEmployee(String name, String position, double hourlyWage)
            this.name = name;
            this.position = position;
            this.hourlyWage = hourlyWage;
        public String getName()
            return name;
        public String getPosition()
            return position;
        public double getHourlyWage()
            return hourlyWage;
        public String toString()
            // don't worry about these methods here.  They're just to make the output look nice
            NumberFormat currency = NumberFormat.getCurrencyInstance();
            return String.format("Name: %-15s    Position: %-15s    Wage: %s",
                    name, position, currency.format(hourlyWage));
    }Now I can create a MyEmployees2 class that holds a single list of MyEmployee objects, like so:
    import java.util.ArrayList;
    public class MyEmployees2
        private ArrayList<MyEmployee> employeeList = new ArrayList<MyEmployee>();
        public boolean add(MyEmployee employee)
            return employeeList.add(employee);
        public boolean remove(MyEmployee employee)
            return employeeList.remove(employee);
        public void display()
            for (MyEmployee employee : employeeList)
                System.out.println(employee);
        public static void main(String[] args)
            MyEmployees2 empl2 = new MyEmployees2();
            empl2.add(new MyEmployee("John Smith", "Salesman", 20));
            empl2.add(new MyEmployee("Jane Smyth", "Salesman", 25));
            empl2.add(new MyEmployee("Fred Flinstone", "Janitor", 15));
            empl2.add(new MyEmployee("Barney Rubble", "Supervisor", 35));
            empl2.add(new MyEmployee("Mr. Spacely", "The Big Boss", 45));
            empl2.display();
    }Now if I want to add an Employee, I only add to one list. Same if I want to remove, only one list, and of course, the same for sorting. It is much safer and easier to do things this way. Make sense?

  • JTextField event output problem

    Hello,
    I am learning Java 2 and creating a swing program to handle mortgage amortization calcs. I have a main and event file.
    In the main, I have JTextFields to display the output of the variable calculations that run in the event program.
    Everything seems to be functioning properly, except that only the last run through the loop displays. I have experimented with "thread sleep" to slow the loop, but still the only output is the last run through the loop.
    Is there anything simple concerning JTextField output and looping that Ive missed?
    Here is my loop:
    void startCalc() {
                   gui.calc.setEnabled(true);
                   gui.reset.setEnabled(true);
                        //get input values and convert from text to numbers
              double prin1 = Double.parseDouble(gui.principle.getText());
                   double interest1 = Double.parseDouble(gui.iRate.getText());
                   int term1 = Integer.parseInt(gui.years.getText());
                        // start monthly payment calc
                   double moint1 = interest1/(12*100);
                   double month1 = term1*12;
                   double pay1 = (prin1 * (moint1/(1-(Math.pow(1 + moint1,-month1)))));
                                  // output to mortgui1
              NumberFormat formatter = new DecimalFormat("0.00");
              gui.pay.setText("$"+ formatter.format(pay1));
              double begin1 = prin1;
                        for(int loan1=0;loan1 < month1;loan1++) {
                                  double intpaid1 = (moint1) * begin1;
                                  double prpaid1 = pay1 - intpaid1;
                                  double end1 = begin1 - prpaid1;
                        begin1 = end1;
                   try{
                        Thread.sleep(100);
                        }catch(InterruptedException e){ };
              gui.amortize.setText("Payment number"+(loan1+1));
                        gui.ipaid.setText("Interest paid is $" formatter.format(intpaid1) " Principal paid is $" +formatter.format(prpaid1));
                        gui.balance.setText("Ending balance is $" +formatter.format(end1));
                        }

    Thanks, as you can see Im pretty new to Java... I will need to add gui.* to the methods you have shown me correct?
    Here is my full code for the event. Mortgui2 is the main file where I have the guis set up.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.text.*;
    import javax.swing.text.*;
    public class Mort2JR implements ActionListener, ItemListener {
    Mortgui2 gui;
    public Mort2JR(Mortgui2 in){
    gui = in;
    // Array for 3 hardcode morts and one freeform
    public void actionPerformed(ActionEvent event){
    String command = event.getActionCommand();
    if (command == "Clear")
    clearAllFields();
    if (command == "Calculate")
         startCalc();
    public void itemStateChanged(ItemEvent event) {
         Object item = event.getItem();
         if (item == gui.sevenYear) {
              gui.iRate.setText("5.35");
              gui.years.setText("7");
              gui.iRate.setEnabled(false);
              gui.years.setEnabled(false);
         if (item == gui.fifteenYear) {
              gui.iRate.setText("5.5");
              gui.years.setText("15");
              gui.iRate.setEnabled(false);
              gui.years.setEnabled(false);
              gui.adhoc.setEnabled(true);
         if (item == gui.thirtyYear) {
              gui.iRate.setText("5.75");
              gui.years.setText("30");
              gui.iRate.setEnabled(false);
              gui.years.setEnabled(false);
              gui.adhoc.setEnabled(true);
         if (item == gui.adhoc) {
              gui.iRate.setEnabled(true);
              gui.years.setEnabled(true);
              void clearAllFields(){
    gui.principle.setText(null);
    gui.iRate.setText(null);
    gui.years.setText(null);
    gui.pay.setText(null);
    void startCalc() {
                   gui.calc.setEnabled(true);
                   gui.reset.setEnabled(true);
                        //get input values and convert from text to numbers
              double prin1 = Double.parseDouble(gui.principle.getText());
                   double interest1 = Double.parseDouble(gui.iRate.getText());
                   int term1 = Integer.parseInt(gui.years.getText());
                        // start monthly payment calc
                   double moint1 = interest1/(12*100);
                   double month1 = term1*12;
                   double pay1 = (prin1 * (moint1/(1-(Math.pow(1 + moint1,-month1)))));
                                  // output to mortgui1
              NumberFormat formatter = new DecimalFormat("0.00");
              gui.pay.setText("$"+ formatter.format(pay1));
    //// Delay between new Mortage amortization schedule
                        //               try{
                        //                         Thread.sleep(4000); // 4000 milliseconds
                        //                         }catch(InterruptedException e){ };
                   // Amortization loop will calculate object attributes for outfile
                   double begin1 = prin1;
                        for(int loan1=0;loan1 < month1;loan1++) {
                                  double intpaid1 = (moint1) * begin1;
                                  double prpaid1 = pay1 - intpaid1;
                                  double end1 = begin1 - prpaid1;
                        begin1 = end1;
                   try{
                        Thread.sleep(100);
                        }catch(InterruptedException e){ };
              gui.amortize.setText("Payment number"+(loan1+1));
                        gui.ipaid.setText("Interest paid is $" formatter.format(intpaid1) " Principal paid is $" +formatter.format(prpaid1));
                        gui.balance.setText("Ending balance is $" +formatter.format(end1));

  • Maintenance View: Loop at screen!

    hi,
    I created a view maintenance on Ztable.
    This table contains 3 fields.
    I want to display one of this fields in "Display Mode" when the user Create/change the table in sm30.
    There is an event in maintenace view that allow me to do this?
    Thank you
    Joseph

    Hi,
    Generate a table maintenance for Z table you created in SE11->Utilities->Table Maintenance Generator.Give appropriate authorisation group while genearting table maintenance.
    Once it's get generated.Then click function group->Main program.
    Uncomment the PBO Include which appears as commented.Give it suitable name.
    Then in the PBO write the following.,
    module display.
    module display output.
    LOOP AT SCREEN.
      if screen-name = 'ZZZtable-FIELDNAME'.
          screen-input = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    endmodule.                
    Hope it helps.If so,reward points.Otherwise ,get back.

  • At selection- screen output issue

    Hi,
    I have a issue regarding at selection-screen output event with radio buttons, 
    Fields are like,
    Block B1
      RB1
    Block B2
    RB2
       field 1 (Check box)
       field 2 (Check box)
    User can select one radio button at a time. If the user clicks on radio button RB1 then fields under Block B2 will be disabled. If user click on RB2 field 1 and fields 2 will be input enabled. Could you please give the solution asap
    Note: Radio buttons are in different selection screen blocks.

    Check this code -
    *SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
    *PARAMETERS:
    *Pi1 TYPE C  RADIOBUTTON GROUP G1 DEFAULT 'X',
    *Pi2 TYPE CHAR25,
    *Pi3 TYPE C  RADIOBUTTON GROUP G1,
    *Pi4 TYPE CHAR25.
    *SELECTION-SCREEN END OF BLOCK B.
    *PARAMETERS check AS CHECKBOX.
    *PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.
    *SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    *PARAMETERS: ip1(10) TYPE c,
               ip2(10) TYPE c,
               ip3(10) TYPE c.
    *SELECTION-SCREEN END OF BLOCK b1.
    *SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
    *PARAMETERS: ip4(10) TYPE c MODIF ID bl2,
               ip5(10) TYPE c MODIF ID bl2,
               ip6(10) TYPE c MODIF ID bl2.
    *SELECTION-SCREEN END OF BLOCK b2.
    *AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
       IF show_all <> 'X' AND
          screen-group1 = 'BL2'.
          screen-active = '0'.
       ENDIF.
       MODIFY SCREEN.
    ENDLOOP.
    Regards,
    Amit Khare
    reward all helpful replies.

  • At selection screen output not responding

    Hi ppl,
    I've 4 selection options in my screen. however I just need user to insert only 1 of the 4 for searching. Therefore i included 4 radio buttons. when user select <i>rbf</i>, <i>sfileno</i> will activer and other 3 will be grayed out, when user select <i>rbi</i>, <i>sidnum</i> will active and other will not be active and so forth. You can see the codes below.
    However, during the program running, I found out when i select <i>rbf,</i> the other select options fields - <i>sfileno</i>, <i>sidnum</i> n <i>scompsno</i> are not inactive/grayed. It is the same when I seledt the other radio button. I just seem that i receive no response from the program. What have i done wrong here. please help. TQ
    SELECTION-SCREEN BEGIN OF BLOCK frm1 WITH FRAME TITLE text-t01 .
    SELECT-OPTIONS : sfileno FOR zlic_masterdb-nofailpermohonan modif id f01
                      sidnum FOR zcustomer-idnumber modif id i01,
                      sconame FOR zcustomer-contactname modif id n01,
                      scompsno FOR zcom_compdhdr-compsno modif id c01.
    PARAMETERS: rbf RADIOBUTTON GROUP g1 ,
    rbi RADIOBUTTON GROUP g1,
    rbn RADIOBUTTON GROUP g1,
    rbc RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END   OF BLOCK frm1.
    INITIALIZATION.
    sfileno = '00001'.
                     AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
      CHECK SCREEN-GROUP1 = 'f01' OR
    SCREEN-GROUP1 = 'i01' OR
    SCREEN-GROUP1 = 'n01' OR
    SCREEN-GROUP1 = 'c01'.
    IF rbf = 'X'.
      IF SCREEN-GROUP1 EQ 'f01'.
        SCREEN-ACTIVE = 1.
      ELSEIF SCREEN-GROUP1 EQ 'i01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'n01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'c01'.
        SCREEN-ACTIVE = 0.
      ENDIF.
    ELSEIF rbi = 'X'.
      IF SCREEN-GROUP1 EQ 'i01'.
        SCREEN-ACTIVE = 1.
      ELSEIF SCREEN-GROUP1 EQ 'f01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'n01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'c01'.
        SCREEN-ACTIVE = 0.
      ENDIF.
    ELSEIF rbn = 'X'.
      IF SCREEN-GROUP1 EQ 'n01'.
        SCREEN-ACTIVE = 1.
      ELSEIF SCREEN-GROUP1 EQ 'f01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'i01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'c01'.
        SCREEN-ACTIVE = 0.
      ENDIF.
    ELSEIF rbc = 'X'.
      IF SCREEN-GROUP1 EQ 'c01'.
        SCREEN-ACTIVE = 1.
      ELSEIF SCREEN-GROUP1 EQ 'f01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'n01'.
        SCREEN-ACTIVE = 0.
      ELSEIF SCREEN-GROUP1 EQ 'i01'.
        SCREEN-ACTIVE = 0.
      ENDIF.
    ENDIF.
    MODIFY SCREEN.
    continue.
    ENDLOOP.

    hi Enzo
    Check my sample code
    TABLES: eban,
            SSCRFIELDS.
    SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    PARAMETER:rad1 RADIOBUTTON GROUP rad USER-COMMAND frad1 DEFAULT 'X',
              rad2 RADIOBUTTON GROUP rad .
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETER: mtr AS CHECKBOX MODIF ID g3 USER-COMMAND chk1,
               p_matnr TYPE eban-matnr MODIF ID g1,
               sloc AS CHECKBOX MODIF ID g3 USER-COMMAND chk2,
               str_loc TYPE eban-lgort MODIF ID g4.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    SELECT-OPTIONS: matnr1 FOR eban-matnr MODIF ID g2.
    SELECTION-SCREEN END OF BLOCK b3.
    SELECTION-SCREEN PUSHBUTTON /20(10) name USER-COMMAND UCOM.
    SELECTION-SCREEN END OF SCREEN 100.
    name = 'FETCH'.
    title = 'Test Report'.
    CALL SELECTION-SCREEN '100'.
    TYPE-POOLS slis.
    * declaration of internal tables and work areas to be used
    DATA: BEGIN OF it_pr OCCURS 0,
          banfn TYPE eban-banfn,
          bnfpo TYPE eban-bnfpo,
          loekz TYPE eban-loekz,
          statu TYPE eban-statu,
          ekgrp TYPE eban-ekgrp,
          matnr TYPE eban-matnr,
          werks TYPE eban-werks,
          lgort TYPE eban-lgort,
          preis TYPE eban-preis,
          peinh TYPE eban-peinh,
          END OF it_pr.
    DATA: BEGIN OF it_mat OCCURS 0,
          matnr TYPE eban-matnr,
          END OF it_mat.
    *DATA:BEGIN OF ITAB1 OCCURS 0,
      DATA: l_answer.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
          wa_fieldcat LIKE LINE OF it_fieldcat,
          it_event TYPE slis_t_event,
          wa_event TYPE slis_alv_event.
    * declaration of variables to be used
    DATA: r_ucomm TYPE sy-ucomm,
          mat_no TYPE eban-matnr,
          len TYPE i VALUE 1,
          count TYPE i VALUE IS INITIAL,
          iflag TYPE i VALUE IS INITIAL,
          iflag1 TYPE i VALUE 0.
    DATA :pr_id TYPE sy-repid,
    rt_extab TYPE slis_t_extab.
    INITIALIZATION.
      pr_id = sy-repid.
    probably it would sol;ve ur problem
    regards
    ravish
    <b>plz dont forget to reward points if helpful</b>

  • At selection screen output problem when a field is obligatory

    Hi All,
    I have two radiobuttons on the selection screen and when I select first radiobutton one screen should display and the other should not be displayed and vice-versa. It is working fine if I do not have a mandatory field.I am pasting my code here.Can anyone please help me how to handle this situation when we have some mandatory fields on one of these screens.
    TABLES : mara,marc.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_meth1 RADIOBUTTON GROUP g1 USER-COMMAND g1,
                 p_meth2 RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK matnr WITH FRAME TITLE text-002.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS : so_matnr FOR marc-matnr MODIF ID m1 obligatory.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS : so_werks FOR marc-werks MODIF ID m1 .
    SELECTION-SCREEN END OF BLOCK matnr.
    SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-003.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: p_fpath TYPE ibipparms-path MODIF ID m2 LOWER CASE.
    SELECTION-SCREEN END OF BLOCK file.
    SELECTION-SCREEN BEGIN OF BLOCK date WITH FRAME TITLE text-004.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS : p_date TYPE datuv.
    SELECTION-SCREEN END OF BLOCK date.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    CASE screen-group1.
    WHEN 'M1'.
    IF p_meth1 = 'X'.
    screen-active = 1.
    ENDIF.
    IF p_meth2 = 'X'.
    screen-active = 0.
    ENDIF.
    WHEN 'M2'.
    IF p_meth2 = 'X'.
    screen-active = 1.
    ELSE.
    screen-active = 0.
    ENDIF.
    IF p_meth1 = 'X'.
    screen-active = 0.
    ENDIF.
    ENDCASE.
    MODIFY SCREEN.
    ENDLOOP.
    Thanks in advance
    Sandeep

    Obligatory fields with your requirement will not work, reason : The GUI checks obligatory fields before passing the control back to the program (i.e Before triggering the PAI )
    If you check for empty fields and give appropriate error message in the PAI, the program will not allow you to switch to the other radio button until you fill something in the fields because the moment you select a radiobutton, it will validate the field and issue the error message.
    So it is like a catch 22 situation.
    All you can really do is to check see which radio button is clicked and then do your processing. Also make sure to assign a user command to the radiobutton and query it in the AT SELECTION SCREEN and based on the radiobutton selected, decide which fields should be validated.
    " Additon...
    INITIALIZATION  " Default values
    p_meth1 = 'X'.
    AT SELECTION-SCREEN.  " General PAI
    if p_meth1 EQ 'X'.
    "validate fields for meth1.
    elseif p_meth2 EQ 'X'.
    " validate fields for meth2.
    endif.
    regards,
    Advait

  • AT-SELECTION SCREEN OUTPUT REQUIREMENT

    AT SELECTION SCREEN OUTPUT
    RADIO BUTTON RECORD1
    RADIO BUTTON RECORD2
    IF SELECT R1
    R2 WILL BE DISABLED
    IF SELECT R2
    R1 WILL BE DISABLED

    hi,
    try like this
    TABLES : kna1, lfa1.
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : rad_but1 RADIOBUTTON GROUP one DEFAULT 'X' USER-COMMAND ucom.
    SELECTION-SCREEN COMMENT 3(26) text-003.
    SELECT-OPTIONS : kunnr FOR kna1-kunnr.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : rad_but2 RADIOBUTTON GROUP one .
    SELECTION-SCREEN COMMENT 3(26) text-004.
    SELECT-OPTIONS : lifnr FOR lfa1-lifnr.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN:END OF BLOCK blk1.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF rad_but1 = 'X'.
          IF screen-name = 'KUNNR-LOW' OR screen-name = 'KUNNR-HIGH' .
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-name = 'LIFNR-LOW' OR screen-name = 'LIFNR-HIGH'.
            screen-input = '0'.
            REFRESH lifnr.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
        IF rad_but2 = 'X'.
          IF screen-name = 'KUNNR-LOW' OR screen-name = 'KUNNR-HIGH'.
            REFRESH kunnr.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-name = 'LIFNR-LOW' OR screen-name = 'LIFNR-HIGH'.
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
      ENDLOOP.
    reward if usefull...

  • Selection screen changes at selection screen output

    Hi all,
    I have to make my one block in selection scren invisible based on a particular condition.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:  s_status FOR g_status NO INTERVALS.
    PARAMETERS    :  p_trans(3) TYPE c,
                     p_hub(3) TYPE c.
    SELECT-OPTIONS:  s_auart  FOR g_auart.
    PARAMETERS:      p_buyt(1) TYPE c.
    SELECT-OPTIONS:
                     s_order  FOR g_vbeln,
                     s_zzhrt  FOR g_zzhrtosec,
                     s_vbeln1 FOR g_vbeln1,
                     s_dccode FOR g_dccode NO INTERVALS,
                     s_pgi   FOR g_pgi.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS    : p_c1 AS CHECKBOX USER-COMMAND cmd.
    SELECT-OPTIONS: s_list FOR g_list NO INTERVALS MODIF ID sc1.
    SELECTION-SCREEN END OF BLOCK blk2 .
    SELECTION-SCREEN BEGIN OF BLOCK blk3 WITH FRAME TITLE text-003.
    PARAMETERS    :  p_c2 AS CHECKBOX USER-COMMAND cmd2.
    SELECT-OPTIONS:  s_mail FOR g_mail NO INTERVALS MODIF ID sc2.
    PARAMETERS:   p_accld LIKE g_saknr DEFAULT '1342009999' MODIF ID sc2
                                                          OBLIGATORY,
                  p_accit LIKE g_saknr DEFAULT '1365009999' MODIF ID sc2
                                                          OBLIGATORY,
                  p_opacc LIKE g_saknr DEFAULT '346100XX99' MODIF ID sc2
                                                          OBLIGATORY,
                  p_lmacc LIKE g_saknr DEFAULT '1393009999' MODIF ID sc2
                                                          OBLIGATORY,
                  p_lmopa LIKE g_saknr DEFAULT '3471009999' MODIF ID sc2
                                                          OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk3.
    The block 3 'blk3' should be made invisible based on a condition.
    I have tried loop at screen-name but its not working.
    Kindly advice.
    Thanks and Regards,
    Divya

    Hi Divya,
    Check the below code.
    tables: pa0000, pa0001.
    parameters: p_chk1 as checkbox user-command rusr,
    p_chk2 as checkbox user-command rusr,
    p_chk3 as checkbox user-command rusr,
    p_chk4 as checkbox user-command rusr,
    p_chk5 as checkbox user-command rusr.
    selection-screen: begin of block blk1 with frame.
    select-options: s_pernr for pa0000-pernr modif id ABC,
    s_stat2 for pa0000-stat2 modif id DEF,
    s_werks for pa0001-werks modif id GHI,
    s_persg for pa0001-persg modif id JKL,
    s_persk for pa0001-persk modif id MNO.
    selection-screen: end of block blk1.
    AT SELECTION-SCREEN output.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'ABC'.
    IF p_chk1 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'DEF'.
    IF p_chk2 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'GHI'.
    IF p_chk3 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'JKL'.
    IF p_chk4 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'MNO'.
    IF p_chk5 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    *Note
    *Titles for check boxes and select options
    *P_CHK1 Personal Number
    *P_CHK2 Employment Status
    *P_CHK3 Personnel Area
    *P_CHK4 Employee Group
    *P_CHK5 Employee Sub group
    *S_PERNR Personal Number
    *S_PERSG Employee Group
    *S_PERSK Employee Sub group
    *S_STAT2 Employment Status
    *S_WERKS Personnel Area

Maybe you are looking for