1 2 Previous Next 24 Replies Latest reply: May 25, 2012 11:49 PM by Ryansun-Oracle RSS

    Setting default value of Tabular form item is not working

    Ryansun-Oracle
      Hi,


      I have a tabular form and in that I want to set the default value of the username to app_user. So in the default value of the item, I wrote v('app_user') and type Pl/SQL, but that does not seem to work. I tried the static application & page item with :app_user. That threw an error.

      Also, I wanted to populate the date field in one column. Doesn't sysdate work?

      Thanks,
      Sun
        • 1. Re: Setting default value of Tabular form item is not working
          VC
          sun1977 wrote:
          Hi,


          I have a tabular form and in that I want to set the default value of the username to app_user. So in the default value of the item, I wrote v('app_user') and type Pl/SQL, but that does not seem to work. I tried the static application & page item with :app_user. That threw an error.
          try v('APP_USER')
          Also, I wanted to populate the date field in one column. Doesn't sysdate work?
          to_char(sysdate)
          Thanks,
          Sun
          • 2. Re: Setting default value of Tabular form item is not working
            Logaa
            hI,
            For username field.

            Change Display As=Display as Text Save State
            Default Typ=Plsql exp
            Default=:APP_USER

            For Date field
            Default Typ=Plsql exp
            Default=SYSDATE
            this works for me.

            Thanks,
            Loga
            • 3. Re: Setting default value of Tabular form item is not working
              Ryansun-Oracle
              VC,

              1. Tried v('APP_USER') with all settings of Default type, No default, PL/SQL and function, item(application and page item) . did not work. With the item option it was throwing an error
              2. The to_char(sysdate) was throwing an error, because that column and field are of type date.

              so both did not work.

              Any other issue maybe?

              Thanks,
              Sun

              Edited by: sun1977 on May 25, 2012 6:20 AM
              • 4. Re: Setting default value of Tabular form item is not working
                Ryansun-Oracle
                Hi Loga,

                Did not work for me. The Display saves state, changes the field to read only, but without the username. Also, the SYSDATE with the pl/sql type did not work too. These are database table form items which I am defaulting at run time. Could that be the reason? In forms we used to just add the default value to the field and it used to work. Not sure If I am missing something here.

                Also, I am wondering, the tabular form is based on the DB table, so I guess, when I open that page, it loads the data from the table. I wonder, is that the reason why the value is not defaulting? IS there a way I can default the value after the execute query state maybe?

                Thanks,
                Sun

                Edited by: sun1977 on May 25, 2012 6:32 AM
                • 5. Re: Setting default value of Tabular form item is not working
                  Bob37
                  Logaa gives the correct answer, but I thought you'd also find this useful

                  http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/bldapp_item.htm#HTMDB25335
                  • 6. Re: Setting default value of Tabular form item is not working
                    Ryansun-Oracle
                    Bob, I did read that. MY problem is that it is still not working. I am wondering if this is because the table is in execute query mode maybe? I am wondering if the default value needs to be added after the tabular data is populated through some other way? Maybe the default value would work only for static non database items?

                    Thanks
                    • 7. Re: Setting default value of Tabular form item is not working
                      VC
                      sun1977 wrote:
                      Bob, I did read that. MY problem is that it is still not working. I am wondering if this is because the table is in execute query mode maybe? I am wondering if the default value needs to be added after the tabular data is populated through some other way? Maybe the default value would work only for static non database items?

                      Thanks
                      No, Default value should work on any type of column

                      What is the display type of the column you were setting the default?

                      Can you reproduce this on apex.oracle.com?
                      • 8. Re: Setting default value of Tabular form item is not working
                        Ryansun-Oracle
                        VC,

                        I don't have an account setup on that. I tried on my local XE and 4.1 also and the same problem. The workaround I did was I put a NVL(name, v('APP_USER')) in the form SQL and that populates the values wherever null. But still wondering why the default did not work!? :/

                        Thanks,
                        Sun
                        • 9. Re: Setting default value of Tabular form item is not working
                          Bob37
                          Bob, I did read that. MY problem is that it is still not working. I am wondering if this is because the table is in execute query mode maybe? I am wondering if the default value needs to be added after the tabular data is populated through some other way? Maybe the default value would work only for static non database items?

                          Thanks
                          You're right, I just tested that using the default setup on the column in report attributes and it did not work.
                          I think you'll have to update the columns with the default value post query but I'm not sure exactly what you need to do.

                          I have a form that has a weight entry column. I tried changing the query to set the default value in the query
                          from..
                          
                          Select Weight
                          From...
                          
                          to
                          
                          Select 999.99 Weight
                          From...
                          That appeared to work, but the 999.99 value was not populated back to the Database since it wasn't entered through the form UI. APEX maintains the entered values internally so it can do its checksumm processing and update modified rows back to the DB. I'm thinking you could update what needs to be updated using Javascript in a Dynamic Action, but I'm afraid I don't know how to do that.

                          Excuse my incorrect assumption when first replying.
                          • 10. Re: Setting default value of Tabular form item is not working
                            Bob37
                            VC
                            No, Default value should work on any type of column
                            I'd be quite happy to hear this is a bug !
                            • 11. Re: Setting default value of Tabular form item is not working
                              Ryansun-Oracle
                              Strange. I just tried to update a simple text field in a Tabular form and I get

                              Current version of data in database has changed since user initiated update process. current row version identifier = "A884FA378C851786DDFE3A33709CB23C" application row version identifier = "7501B09557F8AB3DD6285173879CD88A" (Row 2)


                              No change apart from moving some columns up and down the layout order. !
                              • 12. Re: Setting default value of Tabular form item is not working
                                Bob37
                                I wonder if you have Apex generated column validations. If so, the word is you need to delete them to avoid the checksumm error and recreate them yourself if needed.

                                If that's not the case, I'd put it on apex.oracle.com and have one of the smart guys take a look.
                                • 13. Re: Setting default value of Tabular form item is not working
                                  Ryansun-Oracle
                                  Bob, Apex generated validations as in? The one under page processing. I see three, for the three data columns it checks if the value is a valid date. Are you asking to delete those? I have not even updated those.
                                  • 14. Re: Setting default value of Tabular form item is not working
                                    Bob37
                                    sun1977 wrote:
                                    Bob, Apex generated validations as in? The one under page processing. I see three, for the three data columns it checks if the value is a valid date. Are you asking to delete those? I have not even updated those.
                                    Delete any validations that appear under page processing that Apex auto-created.
                                    That comes from Patrick Wolf. I can't find the thread at the moment
                                    1 2 Previous Next