Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Populating table (Apex 4.2, Oracle 11g)
Populating table [message #577887] Thu, 21 February 2013 08:49 Go to next message
inka
Messages: 14
Registered: February 2013
Junior Member
Hello all,

I have a form with a fiekd that passes a value to another form's field. But when I am trying to submit the second form I get the error message:

ORA-01400: cannot insert NULL into ("CFGMGR"."DATABASE_COMMENT"."DATABASE_ID")

Second Form:

Field Name: P5_DATABASE_ID
Display As: select list

List of value definition
select database_name,database_id from databases

Source Used: Always, replacing any existing value in session state
Source Type: Item(application or page item name)

Source value or expression: P20_DATABASE_ID (Value from the field on the first form)

How can I fix it?
Re: Populating table [message #577912 is a reply to message #577887] Thu, 21 February 2013 13:23 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is there any improvement if you modify this:
Source value or expression: P20_DATABASE_ID 

to
Source value or expression: &P20_DATABASE_ID. 
(note the leading ampersand & and ending dot . characters)
Re: Populating table [message #577914 is a reply to message #577912] Thu, 21 February 2013 13:30 Go to previous messageGo to next message
inka
Messages: 14
Registered: February 2013
Junior Member
No.
Re: Populating table [message #577945 is a reply to message #577914] Fri, 22 February 2013 00:56 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The first form is on page 20. It passes (how?) P20_DATABASE_ID to page 5.
The second form is on page 5. It contains the P5_DATABASE_ID item, its source is set to P20_DATABASE_ID.

Do you see any value in P5_DATABASE_ID when you navigate to that page?
Re: Populating table [message #577998 is a reply to message #577945] Fri, 22 February 2013 09:00 Go to previous messageGo to next message
inka
Messages: 14
Registered: February 2013
Junior Member
It passes P20_DATABASE_ID to page 5 through setting up Source value or expression to P20_DATABASE_ID on page 5. Yes I see the value in P5_DATABASE_ID when I navigate to page 5 and it is the same as P20_DATABASE_ID. I think the problem is that when I try to submit page 5, P20_DATABASE_ID doesn't exist on page 5. Somehow I need to pass P20_DATABASE_ID value to P5_DATABASE_ID and have P5_DATABASE_ID submitted. How do I do it?
Re: Populating table [message #578048 is a reply to message #577998] Sat, 23 February 2013 11:07 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
These two sentences can't be true at the same time:
Quote:

I see the value in P5_DATABASE_ID when I navigate to page 5 and it is the same as P20_DATABASE_ID.

and
Quote:

I think the problem is that when I try to submit page 5, P20_DATABASE_ID doesn't exist on page 5


If you want to submit P5_DATABASE_ID and see it in your table, then that block must be based on an underlying database table, while P5_DATABASE_ID's source must be a Database column whose name is ... well, DATABASE_ID. Otherwise, you'd need to create a process which will fire after validations and computations and perform INSERT DML statement, i.e. you'd have to do that manually, telling Apex what you want to be done when user submits the form.
Re: Populating table [message #578051 is a reply to message #578048] Sat, 23 February 2013 12:39 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yet another idea: check the P5_DATABASE_ID "Display as" property. What is it set to? Try with "Text item".

Or, if it is a tabular form, set it to "Display as Text (saves state)".
Previous Topic: Populate three tables
Next Topic: create remote file with util_file
Goto Forum:
  


Current Time: Thu Mar 28 09:10:44 CDT 2024