Only Dimension Table Values in Combo Box or Drill Down Selections

Hi All,
   How to get only Dimension Table Values instead of Master Data Values in Combo Box or Drill Down Box list of values?
I am getting all the values in 0CALMONTH Combo Box where i need only infoproviders values.
In Entry List tab of Combo Box when i select 0CALMONTH its reading from its Master Data.Is there any option how there is Dimension table in Value help.
In Query, infoobject levels the filter values selection is set as infoprovider only.
Can anyone please let me know how to get only dimension table values when we use combo box.
Thanks & Regards
K.Srinivas Rao

Hi
Create one BI query with only one object in the output of the query. (In your case 0CALMONTH)
So now if when you run the query it will show values which are there in infoprovider. THen drag one form from output of this query in vc & create dropdown list on this.
Is this what you are looking for?
regards
Sandeep

Similar Messages

  • Use only unique values as combo box data provider.

    I have an array collection of objects each of which has a
    property I
    will simply call 'name'. Let us say that this array
    collection contains
    a list of objects with the following name values
    ['George','Fred','George','Ron','Bill','Charlie','Bill','Bill','Percy'].
    I would like to use these names as the data provider of a
    combo box, but
    without the duplicates. What would be the easiest way to
    distill this
    down to an array of unique values to use as this combo box's
    data
    provider in Flex?
    The original array collection was the result of an remote
    object call to
    a cfc that returned a record set from a data store. Is it a
    better
    option to create a new function in this cfc that returns the
    unique list
    I desire, or can I do this easily inside the Flex code since
    I already
    have the complete list?
    TIA
    Ian Skinner

    Untested:
    var aData:Array =
    ['George','Fred','George','Ron','Bill','Charlie','Bill','Bill','Percy'];
    var oCheck:Object = new Object():
    var aUnique:Array = new Array()
    var sValue:String
    for (vari:int=0;i<aData.length;i++) {
    sValue = aData[ i ];
    if (!oCheck[sValue ]) { //is this a unique value?
    oCheck[sValue ] = true; //put this value in the check object
    aUnique.push(sValue)
    Note: if the values contain illegal property name values, yo
    would need to modify this.
    Tracy

  • How can I code a lookup table from a combo box

    Hi, I am trying to use combo boxes on a front page which selects a desired gas.  I then want this to look up a simple 2D table which returns the associated K factor value to be used.  Essentially I need to gain the conversion factor for a selected gas to be used in the block diagram to adjust the outputs and inputs accordingly.  I tried to load an excel file into an array and then extract the desired numeric value but failed. Any help would be great.  I don’t want to be manually inputting the values in the block diagram because there are lots of them so it must be read in from a file of some sort.
    Regards

    Hello Sniepsy,
    You posted this question in the FieldPoint forum, but the
    question appears to have nothing to do with that hardware product.  I can’t deduce from your post what
    programming platform you are using, but I assume that it’s LabVIEW.  If so, you might consider reposting your
    question to the LabVIEW forum.
    I’ll broadly address your question though.  If the number of possible input factors is
    small (say in the order of less than 50), the easiest thing to do is just
    generate 2 1D arrays with one for keys, and one for values.  Make sure the indices match up and just look
    up the index of a key in array 1, and index array 2 with that to get your
    number.  A purist might complain that the
    lookup time would be linear, and we can achieve log-time with sorted lists and
    advanced structures – but since these aren’t in LabVIEW the overhead of
    implementing them might outweigh the benefit.
    Hope this helps! 
    Please let us know if you have further questions.
    Travis M
    LabVIEW R&D
    National Instruments

  • How to set current year,month as default value in combo box

    hi,  im newbie of xcelsius user
    i realize  that hv a issue that display combo box base on year & month
    let said
    <b><u>step 1</u></b>
    I create excel data like this
    <b><u>year___ </u>  </b>    |     <u><b>month_   </b></u> |     <u><b>Product</b></u> |     <u><b>revenue</b></u>
    02-04-09 |     02-04-09 |       a |     $4,154
    03-04-09 |     03-04-09 |       b |     $6,813
    04-05-09 |     04-05-09 |       a |     $9,875
    05-06-09 |     05-06-09 |       b |     $6,813
    06-04-10 |     06-04-10 |       a |     $6,813
    07-04-10 |     07-04-10 |       b |     $9,875
    08-06-10 |     08-06-10 |       a |     $9,875
    22-06-10 |     22-06-10 |       b |     $6,813
    <u><b>Step2</b></u>
    Then i go format cell to format/custom date to year & month
    Eg1: Year u2013>  02-04-09  convert to u2018YYYYu2019 (2009)
    Eg2: Month u2013>  02-04-09  convert to u2018mmmmu2019 (April)
    So output like this
    <u><b>year</b></u> |     <u><b>month</b></u> |     <u><b>Product</b></u> |     <u><b>revenue </b></u>
    2009 |     April |     a |     $4,154
    2009 |     April |     b |     $6,813
    2009 |     May |     a |     $9,875
    2009 |     June |     b |     $6,813
    2010 |     April |     a |     $6,813
    2010 |     April |     b |      $9,875
    2010 |     June |     a |     $9,875
    2010 |     June |     b |     $6,813
    But the problem is when i insert to combo box,use u201Cfilter Row u201D, i excpectation will display only 2009,2010
    But Actual display the Year  in combo box is duplicated :'(
    so any solution ? and then only how to set current year & month as default value  :'(
    thanks,
    regards
    s1
    Edited by: Leong Pui Kee on Feb 25, 2011 5:25 AM
    Edited by: Leong Pui Kee on Feb 25, 2011 5:36 AM

    hi,
    your created  data
    step 1
    I create excel data like this
    year___ | month_ | Product | revenue
    02-04-09 | 02-04-09 | a | $4,154
    03-04-09 | 03-04-09 | b | $6,813
    04-05-09 | 04-05-09 | a | $9,875
    05-06-09 | 05-06-09 | b | $6,813
    06-04-10 | 06-04-10 | a | $6,813
    07-04-10 | 07-04-10 | b | $9,875
    08-06-10 | 08-06-10 | a | $9,875
    22-06-10 | 22-06-10 | b | $6,813
    In this, year and month both are same data, make the diffent data like year  2009, 2010  And month Jan, Feb, March, ...Etc 
    and also one more check you formulas on month and year, select correct source data, destination data  for compoonent..
    OR
    from above, to create a date column and convert  date-->year, date--> month and Explore it.
    All the best,
    Praveen

  • How to get values of combo box?

    Hi All,
    I had a problem that need to be solve asap. I would be very appreciated if anyone could help me.
    I had a combo box that contain a string "Flower and Gifts" and when i passed the value to another jsp file it show only "Flower". I had been think for a long time about this problem. How can i pass the value to another jsp file with the whole value "Flower and Gifts".
    Please reply asap. Thanks all.

    Hi,
    Even i had the same problem earlier. Just try to print the string that you are passing to the next page, if it reads something like this "Flowers%20and%20Gifts" then you have to replace the special characters (i.e.,'%,2,0')with the blank spaces so that you have the complete string.
    Example:
    String str = "Flowers%20and%Gifts";
    if(str.indexOf('%')!=-1)
    str = str.replace('%','');
    Thanks,
    Rkanth

  • While selecting value from combo box in one frame, based on the selection..

    Hi friends,
    can someone help me out on a issue as it follows:-
    iam developing an application where Iam using xsl,html,javascript and xml.
    There is no existense of Database at all. data is read from xml.
    now,
    In a window there are 3 frames. In the 1st frame combo box is there.
    Based on the selection in the combo box data will be displayed in the 2nd frame.
    now onchange or onselect methods not giving the expected result.
    actually,in the the xsl which is having 3 frames,the 1st and 3rd frame
    calling src="abc.xml" and src="abc.xml"which are static.
    but in the 2nd frame the data need to be changed dynamically.
    I have given frame name="frame_ExchangeDetails2" rows="3%" src="cc_marketWatch_02.xml"/>
    usually data dynamically comes from database.but here i have to refer xml file
    something like [window.href.location="abc.xml"]
    but the problem is when you refer supose:-
    <frame name="frame_ExchangeDetails2" rows="3%" src="cc_marketWatch_02.xml"/>
    the frame is having static page,though there are functions in javascript which are called in onload and onchange.which are not working.
    I have tried putting if condition like:-
    if(document.abc.fieldname.value=='6'
    {   window.location.href = "cc_custLookUpData-mobileno.xml";   
    so that it could go to the repective page.
    but it is not working.
    so what should i do if I select from combo box in one frame and based on the selection xml/html page will be displayed in the 2nd frame.
    if anybody has google account i can forward the zip file so it will be easier to understand.
    Regards
    Message was edited by:
    Postqueries
    Message was edited by:
    Postqueries

    If you have rights to modify tabular model then, you can create a measure in your Tabular model which returns previous week and then use this measure in Pivot Table.
    Thanks,
    Sagar K 
    (Blog: http://datamazik.blogspot.in/)

  • ABAP Webdynpro cannot display value help, combo box properly in IE ?

    Hi WDA expert,
    I have problem developing webdynpro in NW 7.0 EHP1 SPS02. All the combo box, value help, drop down input did not properly display using IE 7.0 / 8.0. It is something like create another  blank input beside the original object.
    but everything ok if i am using mozilla firefox.
    I am not sure what is the problem with this.
    Please help.
    Thank You and Best Regards
    Fernand.

    Hi Thomas,
    Thank you for your response, But i am still not able to solve the problem. Let me give you more detail information regarding this issue.
    are you using the Portal? The other poster in this thread seems to think so, but I don't see anything in your postings to indicate that. IE7 is supported on your release/SP level. IE8 is not supported until SPS5.
    => I am not using portal it is just normal test from SAP GUI. I am using IE 8.0.6001.18702. So far i have tested the sample webdynpro "WDR_TEST_SELECT_OPTIONS" to 4 different server (PID, PIQ, ECD, ECQ) all using the same version NW 7.0 EHP 1 SPS02. (i have check for ABAP and BASIS package). The problem only occur in PID (Initially the icm service is not start so i use transaction SICF to start the webdynpro service) not sure if there is missing java script library ?
    Please refer in this link for the different result screen capture below:
    http://i802.photobucket.com/albums/yy310/pisuper/WDA_DEV.jpg   --> error in PID
    http://i802.photobucket.com/albums/yy310/pisuper/WDA_QA.jpg    -
    > success in PIQ, ECD, ECQ
    I would recommend clearing your browser cache and the server side cache. For the server side cache go to transaction SMICM and choose Administration->ICM->Exit Hard->Global.
    I have restarted the whole server and i did again from SMICM. But still having the same problem like in the screen capture.
    Are you using a standard or customized theme?
    I am using standard theme base on demo "WDR_TEST_SELECT_OPTIONS"
    Base on my latest investigation seems like those 3 success server PIQ, ECD and ECQ always download this file ls_ie6.nosprite.css in the internet temporary directory, but then no for PID. 
    is that any idea or suggestion that i can try to solve this problem. it seems like some configuration was missing for the standard theme in PID
    Thank You and Best Regards
    Fernand Lesmana
    Edited by: Fernand Lesmana on Jun 16, 2010 3:52 PM

  • Analyzer 6.5: Linking Table to a combo box

    I created a combo box containing all month from January to December.If the user select for example December, he should get on the report the actual month (=December) and the privious month (=November).How can I do this with analyzer?Additional question: How can I solve this problem when the user select January and he should get January and December on the report?Help is very appreciated.

    Depending on how your outline is set up, there are a few different ways you can do this.For starters if you only need to see current month and previous month, then you might want to look at using substitution variables.Assuming you are not looking to use substituion variables because you are looking to give your users a solution that allows them to go back more than one month, you might want to try something like the following. (It might seem a bit long, but since you are dealing with the time dimension and would only need to repeat the process once for each month, it shouldn't take too long to put it in place.)Here's what you can do:When selecting members for your combo box, you should select the top member of you Time Dimension, for instance 'Year Tot'.Once 'Year Tot' shows on the right side of the selection list, you can right click on it and a menu will come up asking if you also want to include children, descendents, etc.; choose at the bottom of the list "Select Subset". Once there, you want to choose from the drop down, 'Expression Contained is', and type the member name 'Nov', (click the add button), then choose 'Expression Contained is' and type the member name 'Dec' (click the add button). Now go to the advanced button and change your connector from 'And' to 'Or'. Click okay.(Basically you are creating a subset that will return November Or December)You now have a member added to your drop down box called "Year Tot" (or whatever you time dim member name is) Rename 'Year Tot' to "Dec" and click okay. You now have a member in your drop down list called 'Dec' that really represents a subset which includes both Nov and Dec. When users click on Dec in the combo box they will see Nov and Dec in the grid.You would then repeat these steps for each month.As far as January showing The current year January and the previous year December, that can be a little tricky. I'm assuming your time dimsnsion is NOT set up as a fiscal year cross over model and instead you have one dimension with your months and then a scenario type dimension with your years. One solution is to add a 13th month to your month's dimension that does not consolidate. The 13th month can be named 'Prior Yr Dec' You would then write a calc script in Essbase to copy your Dec numbers to Prior Yr Dec. (ie "Prior Yr Dec"->2004 = Dec->2003)Once you have this done, you could easily implement the steps above and achieve the results you are looking for.Best Regards,

  • Dynamic values using combo box

    Hi,
    i have a doubt regarding the combo box.
    do clear it.
    Company [ ]
    bu[ ]
    onselectio of company , i should get bu values....
    i am getting the value in the bu list.......
    but the company name is not getting restored.
    giude me with the code part...
    its urgent...i need it now...
    it would kind enough if some one help me.
    thank u

    Could you provide how ur populating [bu]

  • Trying to get export value from combo box

    Using the "Custom Keystroke Script" for a combo box:
    // This works but gives the current face value
    if( event.willCommit )
        app.alert(event.value);
    // This works but gives the previous export value
    if( event.willCommit )
        app.alert(event.target.value);
    What I need is the clicked items' current export value as soon as it is clicked.
    What am I doing wrong?

    Sorry about that. I posted the question and then realized I should have just used the same thread.
    Any way, I tried your code and it does not show the current export value. It shows the previously selected value.
    Example:
    When I click item 2 it shows item 0
    Then I click item 4 and it shows item 2
    Then I click item 7 and it shows item 4.. etc.. (see the pattern)
    What I need is the value from the item I'm currently clicking on.
    If I click item 2, I expect to see item 2. etc..
    Thank you for your patience in answering this!

  • Problem in populating 2nd combo box depending upon the selection of 1st

    Hi all,
    I have 2 combo boxes on my jsp page ,say continent and country . obviously the data in 2nd box is dependant on selection made in the 1st . I'm using MySQL with tomcat 5.0.7 . and JSP.
    The first combo box in one form and the 2nd in another. After submitting first i 'm populating the second combo also.
    But the problem is after submitting the first form the page gets refreshing and i can't see the selected continent in the first combo box.
    The javascript code used follows:
    function callCapture(form)
    var item = continent.cmbContinent.selectedIndex;
    document.country.hidContId.value=continent.cmbContinent.options[item].value;
    document.continent.action="country.jsp?hidContId="+document.country.hidContId.value+"&buttName="+document.country.buttName.value+"";
    document.continent.target="_self";
    document.continent.submit();
    some one pls help me asap !

    Hi Reegz,
    that's what i'm also doing and i'm successfull till populating the second combo box but how do I keep the previous inputs on the page and reload the page based on the change of a selection box?
    Is their any mistake in the javascript code:
    Here is the code:
    function callCapture(form)
    var item = continent.cmbContinent.selectedIndex;
    document.country.hidContId.value=continent.cmbContinent.options[item].value;
    document.continent.action="country.jsp?hidContId="+document.country.hidContId.value+"&buttName="+document.country.buttName.value+"";
    document.continent.target="_self";
    document.continent.submit();
    Pls help me...

  • Fill a combo box based on the selection of another combo box

    Hi All,
    I am new to jsp & java script. I have a arraylist of communities and there are 2 combo boxes meant for source community & destination community.
    First user will select Source community , after that I've to remove that community from list and display the option for destination community combo box.
    Here the problem is I am getting the source community value in a java script function - "checkSource() " which I've written at the "onClick" of source community.
    Now java script variable has that community & list of community is a java variable, so I am not able to remove that community from java list.
    Please suggest in the same.
    I've written like this -
    function checkSource()
         var selIndex = document.targetForm.srcgroupname.selectedIndex;
    var srcCommunity = document.targetForm.srcgroupname.options[selIndex].value;
    alert("Selected Src Community-"+srcCommunity);
         <%
         alert("Community length-"+community.size());
         community.remove(community.getIndex( %> srcCommunity <%));
         alert(community.size());
         %>
    But this is not working. community is a java list.
    Please help....
    Thanks in Advance
    Sneha

    Do it with AJAX. Here -> http://www.iem.pw.edu.pl/~opalam/sample/TestAJAX.zip You can download a small, sample project that presents AJAX.
    In the project Servlet, Gson and Jquery is used. When onchange is fired in the first select box a js script method is invoked. This method uses ajax to get the json (gson is used to transfer java objects to json) data from the servlet depending on the value of selected option. When data are obtained the second select box is populated. Of course it might be written better but the general idea is clearly visible which was my goal. Hope this helps.

  • Error: "Numeric value entered was too low " -drill down discoverer report

    Hi ,
    We have created a Discoverer drill down report (drill down to another worksheet). We have two worksheets one for the master and and the other for the detail.The parameters are passed to detail sheet (The link information is set using the Manage links option in the Discoverer plus) from the master. This whole thing works fine in dev instance.
    We imported the business area . Deleted the existing file and the opened the new .dis file from local computer and then saved it to db.
    Now the master report runs fine and when we click on the drill down link for the detail we get the following error
    An error occured while handling the event.See the application log for more details.
    - The numerical value entered was too low."
    However the link works fine in plus and desktop in the same instance.
    Kindly help.
    Thanks,
    Shobana

    I hope you're not using Internet Explorer v7.
    It has a specific problem with Disco Viewer, is not certified to work with it, and the error is drilling in Viewer.
    The Oracle bug (metalink) is: 5608740
    This bug prevents the listing of drill items under the drill icon.
    Russ

  • Change table rows with Combo Box

    I want to change the size of the rows displayed per page. I tested this code but the number of the rows is updated only when the pages are switched. Can you tell me how I can fix this?
    import javafx.application.Application;
    import static javafx.application.Application.launch;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.Pagination;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class MainApp extends Application
        final ObservableList<Person> data = FXCollections.observableArrayList(
            new Person("1", "Joe", "Pesci"),
            new Person("2", "Audrey", "Hepburn"),
            new Person("3", "Gregory", "Peck"),
            new Person("4", "Cary", "Grant"),
            new Person("5", "De", "Niro"),
            new Person("6", "Katharine", "Hepburn"),
            new Person("7", "Jack", "Nicholson"),
            new Person("8", "Morgan", "Freeman"),
            new Person("9", "Elizabeth", "Taylor"),
            new Person("10", "Marcello", "Mastroianni"),
            new Person("11", "Innokenty", "Smoktunovsky"),
            new Person("12", "Sophia", "Loren"),
            new Person("32", "Humphrey", "Bogart"));
        private Pagination pagination;
        public static void main(String[] args) throws Exception
            launch(args);
        public int itemsPerPage()
            return 1;
        public static int rowsPerPage = 6;
        final static ObservableList<Integer> rowsPerPages = FXCollections.observableArrayList(5, 10, 15, 20);
        static ComboBox cb = new ComboBox();
        public VBox createPage(int pageIndex)
            cb.setPrefWidth(25);
            cb.setItems(rowsPerPages);
            cb.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent e) {
                    if (cb.getValue() != null && !cb.getValue().toString().isEmpty()){
                        rowsPerPage = (int) cb.getValue();
            int lastIndex = 0;
            int displace = data.size() % rowsPerPage;
            if (displace > 0)
                lastIndex = data.size() / rowsPerPage;
            else
                lastIndex = data.size() / rowsPerPage - 1;
            VBox box = new VBox(5);
            int page = pageIndex * itemsPerPage();
            for (int i = page; i < page + itemsPerPage(); i++)
                TableView<Person> table = new TableView<>();
                TableColumn numCol = new TableColumn("ID");
                numCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("num"));
                numCol.setMinWidth(20);
                TableColumn firstNameCol = new TableColumn("First Name");
                firstNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("firstName"));
                firstNameCol.setMinWidth(160);
                TableColumn lastNameCol = new TableColumn("Last Name");
                lastNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("lastName"));
                lastNameCol.setMinWidth(160);
                table.getColumns().addAll(numCol, firstNameCol, lastNameCol);
                if (lastIndex == pageIndex)
                    table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage, pageIndex * rowsPerPage + displace)));
                else
                    table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage, pageIndex * rowsPerPage + rowsPerPage)));
                box.getChildren().addAll(table, cb);
            return box;
        @Override
        public void start(final Stage stage) throws Exception
            pagination = new Pagination((data.size() / rowsPerPage + 1), 0);
            //   pagination = new Pagination(20 , 0);
            //pagination.setStyle("-fx-border-color:red;");
            pagination.setPageFactory(new Callback<Integer, Node>()
                @Override
                public Node call(Integer pageIndex)
                    if (pageIndex > data.size() / rowsPerPage + 1)
                        return null;
                    else
                        return createPage(pageIndex);
            AnchorPane anchor = new AnchorPane();
            AnchorPane.setTopAnchor(pagination, 10.0);
            AnchorPane.setRightAnchor(pagination, 10.0);
            AnchorPane.setBottomAnchor(pagination, 10.0);
            AnchorPane.setLeftAnchor(pagination, 10.0);
            anchor.getChildren().addAll(pagination);
            Scene scene = new Scene(anchor, 400, 250);
            stage.setScene(scene);
            stage.setTitle("Table pager");
            stage.show();
        public static class Person
            private final SimpleStringProperty num;
            private final SimpleStringProperty firstName;
            private final SimpleStringProperty lastName;
            private Person(String id, String fName, String lName)
                this.firstName = new SimpleStringProperty(fName);
                this.lastName = new SimpleStringProperty(lName);
                this.num = new SimpleStringProperty(id);
            public String getFirstName()
                return firstName.get();
            public void setFirstName(String fName)
                firstName.set(fName);
            public String getLastName()
                return lastName.get();
            public void setLastName(String fName)
                lastName.set(fName);
            public String getNum()
                return num.get();
            public void setNum(String id)
                num.set(id);

    Hi.  I slightly modified your code:
            comboBox.valueProperty().addListener(new ChangeListener<Number>() {
                @Override
                public void changed(ObservableValue o, Number oldVal, Number newVal) {
                    //System.out.println(newVal.intValue());
                    intP.set(newVal.intValue());
                    paginate();
    Here is the complete example:
    import java.util.List;
    import javafx.application.Application;
    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.SimpleIntegerProperty;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.ListChangeListener;
    import javafx.collections.ListChangeListener.Change;
    import javafx.collections.ObservableList;
    import javafx.scene.Scene;
    import javafx.scene.control.Pagination;
    import javafx.scene.Node;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextArea;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class TablePager extends Application {
        IntegerProperty intP = new SimpleIntegerProperty(5);
        AnchorPane anchor = new AnchorPane();
        Scene scene;
        ObservableList<Integer> options =
                FXCollections.observableArrayList(
                5,
                10,
                15,
                20);
        final ComboBox comboBox = new ComboBox(options);
        final ObservableList<Person> data = FXCollections.observableArrayList(
                new Person("1", "Joe", "Pesci"),
                new Person("2", "Audrey", "Hepburn"),
                new Person("3", "Gregory", "Peck"),
                new Person("4", "Cary", "Grant"),
                new Person("5", "De", "Niro"),
                new Person("6", "Katharine", "Hepburn"),
                new Person("7", "Jack", "Nicholson"),
                new Person("8", "Morgan", "Freeman"),
                new Person("9", "Elizabeth", "Taylor"),
                new Person("10", "Marcello", "Mastroianni"),
                new Person("11", "Innokenty", "Smoktunovsky"),
                new Person("12", "Sophia", "Loren"),
                new Person("13", "Alexander", "Kalyagin"),
                new Person("14", "Peter", "OToole"),
                new Person("15", "Gene", "Wilder"),
                new Person("16", "Evgeny", "Evstegneev"),
                new Person("17", "Michael", "Caine"),
                new Person("18", "Jean-Paul", "Belmondo"),
                new Person("19", " Julia", "Roberts"),
                new Person("20", "James", "Stewart"),
                new Person("21", "Sandra", "Bullock"),
                new Person("22", "Paul", "Newman"),
                new Person("23", "Oleg", "Tabakov"),
                new Person("24", "Mary", "Steenburgen"),
                new Person("25", "Jackie", "Chan"),
                new Person("26", "Rodney", "Dangerfield"),
                new Person("27", "Betty", "White"),
                new Person("28", "Eddie", "Murphy"),
                new Person("29", "Amitabh", "Bachchan"),
                new Person("30", "Nicole", "Kidman"),
                new Person("31", "Adriano", "Celentano"),
                new Person("32", "Rhonda", " Fleming's"),
                new Person("32", "Humphrey", "Bogart"));
        private Pagination pagination;
        public static void main(String[] args) throws Exception {
            launch(args);
        public int itemsPerPage() {
            return 1;
        public int rowsPerPage() {
            return intP.get();
        public VBox createPage(int pageIndex) {
            int lastIndex = 0;
            int displace = data.size() % rowsPerPage();
            if (displace > 0) {
                lastIndex = data.size() / rowsPerPage();
            } else {
                lastIndex = data.size() / rowsPerPage() - 1;
            VBox box = new VBox();
            int page = pageIndex * itemsPerPage();
            for (int i = page; i < page + itemsPerPage(); i++) {
                TableView<Person> table = new TableView<Person>();
                TableColumn numCol = new TableColumn("ID");
                numCol.setCellValueFactory(
                        new PropertyValueFactory<Person, String>("num"));
                numCol.setMinWidth(20);
                TableColumn firstNameCol = new TableColumn("First Name");
                firstNameCol.setCellValueFactory(
                        new PropertyValueFactory<Person, String>("firstName"));
                firstNameCol.setMinWidth(160);
                TableColumn lastNameCol = new TableColumn("Last Name");
                lastNameCol.setCellValueFactory(
                        new PropertyValueFactory<Person, String>("lastName"));
                lastNameCol.setMinWidth(160);
                table.getColumns().addAll(numCol, firstNameCol, lastNameCol);
                if (lastIndex == pageIndex) {
                    table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage(), pageIndex * rowsPerPage() + displace)));
                } else {
                    table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage(), pageIndex * rowsPerPage() + rowsPerPage())));
                box.getChildren().addAll(table);
            return box;
        @Override
        public void start(final Stage stage) throws Exception {
            scene = new Scene(anchor, 450, 450);
            comboBox.valueProperty().addListener(new ChangeListener<Number>() {
                @Override
                public void changed(ObservableValue o, Number oldVal, Number newVal) {
                    //System.out.println(newVal.intValue());
                    intP.set(newVal.intValue());
                    paginate();
            paginate();
            stage.setScene(scene);
            stage.setTitle("Table pager");
            stage.show();
        public void paginate() {
            pagination = new Pagination((data.size() / rowsPerPage() + 1), 0);
            //   pagination = new Pagination(20 , 0);
            pagination.setStyle("-fx-border-color:red;");
            pagination.setPageFactory(new Callback<Integer, Node>() {
                @Override
                public Node call(Integer pageIndex) {
                    if (pageIndex > data.size() / rowsPerPage() + 1) {
                        return null;
                    } else {
                        return createPage(pageIndex);
            AnchorPane.setTopAnchor(pagination, 10.0);
            AnchorPane.setRightAnchor(pagination, 10.0);
            AnchorPane.setBottomAnchor(pagination, 10.0);
            AnchorPane.setLeftAnchor(pagination, 10.0);
            AnchorPane.setBottomAnchor(comboBox, 40.0);
            AnchorPane.setLeftAnchor(comboBox, 12.0);
            anchor.getChildren().clear();
            anchor.getChildren().addAll(pagination, comboBox);
        public static class Person {
            private final SimpleStringProperty num;
            private final SimpleStringProperty firstName;
            private final SimpleStringProperty lastName;
            private Person(String id, String fName, String lName) {
                this.firstName = new SimpleStringProperty(fName);
                this.lastName = new SimpleStringProperty(lName);
                this.num = new SimpleStringProperty(id);
            public String getFirstName() {
                return firstName.get();
            public void setFirstName(String fName) {
                firstName.set(fName);
            public String getLastName() {
                return lastName.get();
            public void setLastName(String fName) {
                lastName.set(fName);
            public String getNum() {
                return num.get();
            public void setNum(String id) {
                num.set(id);

  • Trying to update table based on combo box choice

    Hey all,
    I have taken over code someone has created and it is confusing me what they have done. the code uses an abstracttablemodel to create the table (and i assume, fill the data). I can't for the life of me, figure out how the data is loaded. Can someone tell me what is happening. also, what would be the easiest way to update it to only show that info that matches the criteria? I will post what i think is relevant code, but if i am missing something, i will be happy to throw it in there. Here's the code:
    public class ABMD extends JPanel implements ActionListener
    private JTable table;
        private TableSorter sorter;
    public ABMD()
    sorter = new TableSorter(new ABMDTableModel());
            table = new JTable(sorter);
            sorter.setTableHeader(table.getTableHeader());
            ListSelectionModel rowSM = table.getSelectionModel();
            rowSM.addListSelectionListener(new ListSelectionListener()
                public void valueChanged(ListSelectionEvent e)
                    if (e.getValueIsAdjusting()) return;
                    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
                    if (lsm.isSelectionEmpty())
                        viewDataButton.setEnabled(false);
                        getDataButton.setEnabled(false);
                        removeDataButton.setEnabled(false);
                    else
                        int selectedRow = sorter.modelIndex(table.getSelectedRow());
                        PlanData currentPlanData = (PlanData) planArrayList.get(selectedRow);
                        if (!currentPlanData.getPlanListLoaded())
                            getDataButton.setEnabled(true);
                            viewDataButton.setEnabled(false);
                            removeDataButton.setEnabled(false);
                        else
                            getDataButton.setEnabled(false);
                            viewDataButton.setEnabled(true);
                            removeDataButton.setEnabled(true);
                        String desc = "";
                        desc = currentPlanData.getUniqueID();
                        descTextAreaValue.setText(desc);
    class ABMDTableModel extends AbstractTableModel
            private String[] columnNames = {"Plan Local",
                    "OPLAN",
                    "Air Defense Plan",
                    "Planning Period",
                    "Defense Design",
                    "Published Date"
            public int getColumnCount()
                return columnNames.length;
            public int getRowCount()
                return planArrayList.size();
            public String getColumnName(int col)
                return columnNames[col];
            public Object getValueAt(int row, int col)
                PlanData planData = (PlanData) planArrayList.get(row);
                switch(col)
                    case 0:
                        return Boolean.valueOf(planData.getPlanListLoaded());
                    case 1:
                        return planData.getOplan();
                    case 2:
                        return planData.getAirDefensePlan();
                    case 3:
                        return planData.getPlanningPeriod();
                    case 4:
                        return planData.getDefenseDesign();
                    case 5:
                        return planData.getPublishedDate();
                throw new IllegalArgumentException("Illegal Column: " + getColumnName(col));
            public Class getColumnClass(int c)
                return getValueAt(0, c).getClass();
            public boolean isCellEditable(int row, int col)
                return false;
    }

    I can't for the life of me, figure out how the data is loadedLooking at the get value method we see:
    PlanData planData = (PlanData) planArrayList.get(row);Therefore the data is store in the "planArrayList". So the data is loaded whenever you add data to that ArrayList.

Maybe you are looking for