Topic
23 replies Latest Post - ‏2012-05-10T16:48:26Z by mburati
SystemAdmin
SystemAdmin
9029 Posts
ACCEPTED ANSWER

Pinned topic select variables getting null values in a portlet

‏2009-12-15T14:56:40Z |
Hi,

I am trying to show different values in each Status Page for each location selected from the dropdown. When I select a location from the dropdown the "varBrachNameSelect" variable doesnot take the selected value and just has a null value and hence getting error as in the "sysOut.txt". I tried giving different variables and different dropdown tag names for each of the Status Pages but still no luck.

Could someone help me in suggesting as to why the "BrachNameSelect" variables are not able to take the changed values after pageload and just giving the null values.

Thanks in advance!!
Updated on 2012-05-10T16:48:26Z at 2012-05-10T16:48:26Z by mburati
  • SystemAdmin
    SystemAdmin
    9029 Posts
    ACCEPTED ANSWER

    Re: select variables getting null values in a portlet

    ‏2009-12-15T14:59:34Z  in response to SystemAdmin
    Are you using PageAutomation (i.e. Data Page and his cronies) to make your Select, or just a Select builder? You only get the automatic copying of the data back into the variable if you are using PageAutomation. (A quick look at your model looks like the answer is no.)

    If you are using it, have you informed it that this is a Data Entry field? Otherwise it, again, won't copy the data into the Variable.

    The best way to have any input form, even a single field, is to use PageAutomation. Create a variable to hold the value and then use either Data Page set for Data Entry (if you already have the page you want it on) or Input Form (which is little more than Imported Page and Data Page).

    For the field to be a select, usually the best answer is to create a lookup table and then apply it to the field with a Data Field modifier. The advantage of a lookup table is that there are a variety of sources for the data, you can easily internationalize them, and you can apply it to several fields in one DFM (or RDD) and it will make a select if the field is data entry, and a translated text field if it is for display.
    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: select variables getting null values in a portlet

      ‏2009-12-15T15:59:52Z  in response to SystemAdmin
      Thanks for the reply Steve!!
      I am using a Select builder giving the "Select Data" input with xml variable "varBranchNames" which has the dropdown values. So "varBrachNameSelect" just need to take the values from "varBranchNames" when selected.
      So it doesnt require a Data Page, you have mistakenly understood it to be a data entry select field but its a dropdown with prepopulated values.
      I have worked in a similar scenario for one dropdown in a portlet which is picking up the selected value from browser but this is having 5 dropdown variables in a single portlet and for some reason it doesnot pick up the selected values from the browser.
      • SystemAdmin
        SystemAdmin
        9029 Posts
        ACCEPTED ANSWER

        Re: select variables getting null values in a portlet

        ‏2009-12-15T16:24:04Z  in response to SystemAdmin
        That's what a data entry select field is. While it doesn't require a Data Page to do a simple input form, you are generally better off if you do it that way. That's my point. When you do this yourself, there are a number of steps to get right, including the one below, or you can just let the automation do it for you (and it always gets it right). The only reason, IMHO, to be doing this yourself is if you are using a multi-value select, which isn't currently supported by PageAutomation.

        I can't actually build and run your model because I don't have the LJO's and other supporting stuff. But from looking at it quickly, I see you are copying the values from RequestInputs back into your variables in the actBranchSelect action list. (This step is done for you automatically if you are using PageAutomation.) I have no idea whether this bit is executing correctly or not. I see that you have several HTML Event actions calling this, and they all copy all three values. Are they all on the screen at the time? If you are copying one that wasn't available, then it will wipe out the value that used to be there.

        Also, I'm still not sure if you are saying that the options (the choices) aren't appearing in the select, or that the correct one isn't coming up as already selected. Assuming it is the latter, then my suspicion is that you are wiping the value out in your actBranchSelect method when you are calling from a page that doesn't include that select.
        • SystemAdmin
          SystemAdmin
          9029 Posts
          ACCEPTED ANSWER

          Re: select variables getting null values in a portlet

          ‏2009-12-16T10:26:27Z  in response to SystemAdmin
          The option of the dropodown are appearing and Status page builders are giving the chart with default values but the problem is the selected value from the browser is not being passed to the select input and hence the value assigned to the select input is getting null value.

          All these variable are in the same screen. I tried adding a seperate Action List for each of the Status Pages but still it didnt work.

          I tried to add the Data Page(disabled builders) but was stuck with the fact that I dont have the option to give the xml vairable "varBranchNames" which has the list of the dropdown values, whereas the Select builder has that option.
          • SystemAdmin
            SystemAdmin
            9029 Posts
            ACCEPTED ANSWER

            Re: select variables getting null values in a portlet

            ‏2009-12-16T15:54:11Z  in response to SystemAdmin
            Sure you can. Not only can you give XML variables as the choices using a Data Field Modifier, you can also just use a Select builder to manage the control, as long as you have informed PageAutomation that the element in question is a Data Entry field (which you will have already done by selecting Data Entry type for the entire Data Page.

            I still can't do anything with your model, since I don't have the LJO's and such. If you want to make a simple sample that works on its own, I'll try it. But I still contend that PageAutomation is the way to go.

            One other problem that people run into a lot, which I don't think is your problem but I thought I'd mention it. When running in Portal, by the time you are rendering the page (i.e. running the JSP) there is no longer anything in RequestInputs, so you have to save the values from RequestInputs into a variable somewhere, and make sure that your page elements (i.e. your Select) are getting the values from ${Variable/...} and never from ${Inputs/...}. The latter will work when the model is running standalone, but not inside a portal.
            • SystemAdmin
              SystemAdmin
              9029 Posts
              ACCEPTED ANSWER

              Re: select variables getting null values in a portlet

              ‏2009-12-17T09:47:54Z  in response to SystemAdmin
              Hi Steve,
              PFA model w/o any of my project references and can be run.

              Can you pls help me how to use the DFM builder to show the dropdown values rather than using the select builder.

              Also can you pls suggest with regards to profiling the dropdown so that when a user log's in, it identifies the location and just show that loction value, for ex if "GLASGOW SERVICE BRANCH" person log's in on load the indicators should show the value against that branch.

              Thanks in advance!!
              • SystemAdmin
                SystemAdmin
                9029 Posts
                ACCEPTED ANSWER

                Re: select variables getting null values in a portlet

                ‏2009-12-17T15:05:25Z  in response to SystemAdmin
                In the Data Field Modifier (DFM) you select Field Behavior: Data Entry, and Control Type: Select, and it will give other inputs to manage the source of choices for the select.

                Also right there, you can set an initial value for the field. This is the value that gets set when the model is first loaded for that user. You could profile this value so that it is different based on the user.
                • SystemAdmin
                  SystemAdmin
                  9029 Posts
                  ACCEPTED ANSWER

                  Re: select variables getting null values in a portlet

                  ‏2009-12-21T16:20:21Z  in response to SystemAdmin
                  Hi Steve,

                  I have used the DFM Builder for the dropdown but still it doesnt seem to pick up the the changed value. Could you pls have a look at the model and suggest me.
                  • SystemAdmin
                    SystemAdmin
                    9029 Posts
                    ACCEPTED ANSWER

                    Re: select variables getting null values in a portlet

                    ‏2009-12-22T14:48:46Z  in response to SystemAdmin
                    It would probably be best to post a simple model (using only core Factory builder) that shows the use case you are having trouble with. Also when you are making a archive to post it's best to create it using the Export/WebSphere Portlet Factory Zip Archive.
                    Tom
                    • SystemAdmin
                      SystemAdmin
                      9029 Posts
                      ACCEPTED ANSWER

                      Re: select variables getting null values in a portlet

                      ‏2009-12-22T16:13:19Z  in response to SystemAdmin
                      Sorry, I have posted a simple model with the requiref files. WPF Archive is massive and unable to upload.
                      • SystemAdmin
                        SystemAdmin
                        9029 Posts
                        ACCEPTED ANSWER

                        Re: select variables getting null values in a portlet

                        ‏2009-12-23T01:59:01Z  in response to SystemAdmin
                        I don't see any attachments with your post. When creating a WPF Archive you should only select the files you wish to export (i.e. not the entire project).
                        Tom
                        • SystemAdmin
                          SystemAdmin
                          9029 Posts
                          ACCEPTED ANSWER

                          Re: select variables getting null values in a portlet

                          ‏2009-12-23T10:19:44Z  in response to SystemAdmin
                          PFA. Putting forward agian the issue is that even the DFM builders are not passing the selected inputs to the variables which are in a single page. Just getting null values eventhough the values are selected from the dropdown input.
                          • SystemAdmin
                            SystemAdmin
                            9029 Posts
                            ACCEPTED ANSWER

                            Re: select variables getting null values in a portlet

                            ‏2009-12-23T15:27:22Z  in response to SystemAdmin
                            Hmmm... that sample looks pretty much like your original, so I can't run it. I have attached a very simple model that uses a DFM to create a select.

                            Tom
                            • SystemAdmin
                              SystemAdmin
                              9029 Posts
                              ACCEPTED ANSWER

                              Re: select variables getting null values in a portlet

                              ‏2009-12-23T16:20:45Z  in response to SystemAdmin
                              Thanks for your time Tom.
                              I was able to create the dropdown select using DFM builder, problem is am having 5 dropdown inputs from the in a single page and the the inputs are giving null values upon selecting a value from the dropdown.

                              The model can be run by just changing the class location in LJO and "Status Page" input in Status Pge builder to the html files in the folder. By the way Status Page builder is a dashboard framework builder and am not sure if Status Page builder works with WPF install.

                              Also pls see the screenshot of the portlet to get an idea.
                              • SystemAdmin
                                SystemAdmin
                                9029 Posts
                                ACCEPTED ANSWER

                                Re: select variables getting null values in a portlet

                                ‏2009-12-23T17:34:31Z  in response to SystemAdmin
                                Unfortunately I don't have the dashboard framework installed. Perhaps you can modify my sample to be closer to what you are trying todo, or simplify yours so that it doesn't include the dashboard builders.

                                What you are trying to do seems pretty simple, so you may want to verify the input name of the select matches what you think it should be. Maybe take a look at the generated JSP, and rendered HTML page. I also see you have a single form element doing the submit so all the selects will submit their value each time, which shouldn't be a problem unless they are the same name.

                                On an unrelated note - each section seems like a repeated pattern, so you may want to consider creating a builder if you use that pattern in other places.

                                Tom
                                • SystemAdmin
                                  SystemAdmin
                                  9029 Posts
                                  ACCEPTED ANSWER

                                  Re: select variables getting null values in a portlet

                                  ‏2010-01-05T16:52:41Z  in response to SystemAdmin
                                  I don't have them, either. But just glancing at your model in a text editor (!!) I see that all the Data Page builders are based on the same variable. This seems a little odd, to me -- are they all showing at the same time? They will fight, and it isn't likely to do what you want.

                                  Also, I noticed that you have an initial value set in your DFM. If you have the setting in the Data Page which tells it to run the initialization function every time the page loads, this would explain your problem. (I didn't see it, but it's challenging in just a text editor.)
  • SystemAdmin
    SystemAdmin
    9029 Posts
    ACCEPTED ANSWER

    Re: select variables getting null values in a portlet

    ‏2010-05-20T15:25:50Z  in response to SystemAdmin
    Hi,

    Its the same scenario as earlier and not using the dashboard builders. SelectSample.model provided by Tom takes the different values from the dropdown but my model doesnot. Always only "All" value is being selected by the select eventhough I select a different value from the dropdown.

    I have tried with Select and DFM builders.

    Thank you very much for your time!!

    Attachments

    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: select variables getting null values in a portlet

      ‏2010-05-20T15:26:52Z  in response to SystemAdmin
      PFA model.
      • SystemAdmin
        SystemAdmin
        9029 Posts
        ACCEPTED ANSWER

        Re: select variables getting null values in a portlet

        ‏2010-05-25T11:40:39Z  in response to SystemAdmin
        the issue is resolved, thanks for your time.
        • SystemAdmin
          SystemAdmin
          9029 Posts
          ACCEPTED ANSWER

          Re: select variables getting null values in a portlet

          ‏2011-11-04T15:52:00Z  in response to SystemAdmin
          Can you explain how you resolved the issue?
          I am having a similar issue, I have a select control where the data (Employee name) is populated from a lookup table.
          So the generated source has something like this for the select control:
          <option value="65">ARNOLD, ROBERT</option>
          <option value="6200">ARNOLD, ROBERT</option>
          <option value="34105">AZOFEIFA, FLOR</option>
          <option value="30200">BANEGAS, CARLOS</option>
          When I have duplicate values (ARNOLD, ROBERT in this case), regardless of the value I select, I always get the first id which is 65.
          Is there any way to assign the actual id of the selected value? I tried using DFM and still no luck.

          Thanks
          • SystemAdmin
            SystemAdmin
            9029 Posts
            ACCEPTED ANSWER

            Re: select variables getting null values in a portlet

            ‏2011-11-04T18:02:00Z  in response to SystemAdmin
            That behavior is coming from the browser; it's nothing specific to the Factory. It only sends me the value of the option; the DataSave code doesn't even have access to the readable values. I wouldn't be very surprised to find out that the behavior is different on different browsers! (I have no idea if it is, but I wouldn't want to trust it.)

            Anyway, you need to prevent these duplicate readable values. How do you expect your user to know which one to choose, anyway? Perhaps you can append the actual value in parentheses after text, so the visible text is always different.
        • manytoanil
          manytoanil
          1 Post
          ACCEPTED ANSWER

          Re: select variables getting null values in a portlet

          ‏2012-05-10T16:03:01Z  in response to SystemAdmin
          Hi,
          I'm new to portlet factory. Even I'm facing the same issue. Can you please let me know, how does it got resolved and do the needful.
          • mburati
            mburati
            2538 Posts
            ACCEPTED ANSWER

            Re: select variables getting null values in a portlet

            ‏2012-05-10T16:48:26Z  in response to manytoanil
            There are multiple issues discussed in the above multi-page thread, so it's hard to tell from your brief statement which issue you're having and whether it's really the same as any of them.

            Could you please start a new thread with more details about your current issue and if possible, a sample model (without any confidential info or intellectual property contained) that exhibits the problem you're having?

            ..mb1