Home » Developer & Programmer » Application Express & MOD_PLSQL » Update statement not working with Row selector (Apex 4.1, windows 7)
Update statement not working with Row selector [message #565612] Wed, 05 September 2012 09:15 Go to next message
tinkuvinay
Messages: 9
Registered: December 2011
Location: Dallas
Junior Member
I have a row selector which selects all the records in the page. I use the select all check box which will select all the records in the page and then I have a button "resubmit". This button will update one of the column in all the selected records from 'N' to 'Y'. When the selected records are less than 400 this is working, when it is more than that, then I'm getting a http 400 bad request error../fa/10405/0/
  • Attachment: error.PNG
    (Size: 29.22KB, Downloaded 261 times)
Re: Update statement not working with Row selector [message #565764 is a reply to message #565612] Thu, 06 September 2012 10:33 Go to previous messageGo to next message
Littlefoot
Messages: 18833
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is a tabular form, right?

Go to its Report Attributes page and check "Maximum row count" under "Layout and Pagination" section. What is it set to?
Re: Update statement not working with Row selector [message #565778 is a reply to message #565612] Thu, 06 September 2012 11:32 Go to previous messageGo to next message
tinkuvinay
Messages: 9
Registered: December 2011
Location: Dallas
Junior Member
I was able to figure the solution for my problem. When this application was build in older version of apex (in 3.2.1), the select query has HTMLDB_ITEM.checkbox (1,pk_column_name,null) check_to_select. And Since this didn't worked(select all box didn't worked) in the new 4.1 apex version, instead of removing this line from query, I added a row selector from the apex tool which worked for me. Now I had both the row selector and the check box column from the query. Some how this didn't worked and when I select more than certain number of rows, I used to get the 400 Bad Request Error.

Now the other part of this problem is, after selecting the records, when I push the button to update the records, it isn't working. Since the earlier query has the check box replaced by the primary key column, the pk column value is used to update. Now I want to update the record based on the rownum of the selected records.
Re: Update statement not working with Row selector [message #565809 is a reply to message #565778] Thu, 06 September 2012 14:12 Go to previous message
Littlefoot
Messages: 18833
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is it a complex page? Could you rewrite it now that you're on Apex 4.1? I'm far from being an expert here (that's probably why I have such a stupid idea) but - from my own experience - I found out that sometimes it is easier to rewrite it from scratch than to fix something. Certainly, if there are many validations, processes, whatever, you might miss something and cause even more problems than you have now so - think twice.

Anyway: by default, tabular form's "Apply changes" button works just fine and updates fields you changed. I don't know what might cause it not to work correctly. Not to mention what to do in order to fix the fact that "check box was replaced by the primary key column".

If you insist, you might try to manually do the update. You'd do that by looping through all records; something like this:
for i in 1..APEX_APPLICATION.G_F05.count loop
  if APEX_APPLICATION.G_F05(i) = 1 then      -- checkbox checked
     update your_table set
       some_column = APEX_APPLICATION.G_F02(i)
       where some_id = APEX_APPLICATION.G_F01(i);
  end if;
end loop;

G_Fxx represent editable page fields (you'll find much more information in documentation).

[Updated on: Thu, 06 September 2012 14:13]

Report message to a moderator

Previous Topic: Tabular form highlighting all column instead of faulty entry cell
Next Topic: Apex page performance
Goto Forum:
  


Current Time: Sat Apr 19 20:58:56 CDT 2014

Total time taken to generate the page: 0.07434 seconds