Home » Developer & Programmer » Forms » How do you use a created table in a data block? (Oracle Forms 10.1.2, Windows 7)
How do you use a created table in a data block? [message #583549] Wed, 01 May 2013 14:44 Go to next message
Grime
Messages: 3
Registered: May 2013
Junior Member
Hello all, I apologize if this has been brought up before but I certainly couldn't find it on google and I didn't find it here either. I have data that the user is modifying on the form and a data block that is supposed to reflect those change (summaries) So I created
  TYPE VehicleInfo IS RECORD (Vehicle_Desc     ctl_fleet_vehicles.Vehicle_Desc%Type,
                              Miles            timecapture.miles%Type,
                              Hours            TimeCapture.Equipment_hours%Type);
                                 
	TYPE VehicleTab IS TABLE OF VehicleInfo 
		INDEX BY BINARY_INTEGER;
		
	VehicleObj            VehicleTab;


I fill this up with the correct data, but I would like to be able to use this as a table in the data block (called Vehicle_Summary) In the past I have piped tables into data blocks from the server, but I'm unsure how to use a table I created in forms in the Query Data Source Name of the data block.

Thank you for any help you may be able to provide, and I apologize if I missed a previous answer to this on the board.
Re: How do you use a created table in a data block? [message #583556 is a reply to message #583549] Wed, 01 May 2013 14:59 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is how I understood the problem: there's a form whose data block is based on a table. User enters some values in there.

You have another (summary) block. In order to populate it, you created - within a form - the structure described above (TYPE this, TYPE that).

Right?

I see two options: move that structure into a database package; create a procedure which will return associative array (i.e. summaries). Base the second form block on that procedure.

Another option (much simpler) is to create a view which will display values you need; base the block on that view.
Re: How do you use a created table in a data block? [message #583557 is a reply to message #583556] Wed, 01 May 2013 15:18 Go to previous messageGo to next message
Grime
Messages: 3
Registered: May 2013
Junior Member
Ok I apologize a bit, I come from an MS back ground and am just familiarizing myself with oracle terminology. There is no way to just use the structure I created to fill the data block (as a quasi table)? I understand the view, but I would have to build it off the structure as the summary block needs to be updated before the user saves the data.

Yeah I've seen where you move it into a package before then pipe the structures contents down into the data block. That seemed fairly contrived since the data is already existing on the form. I have also tried manually updating the summary fields, but oracle doesn't seem to really want you messing around in there like that.

So I'm not sure how the vies suggestion would work without my saving the data to the database (which is a no go).
Re: How do you use a created table in a data block? [message #583559 is a reply to message #583557] Wed, 01 May 2013 15:24 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, you don't have to COMMIT data - it would be enough just to POST it (which would store these values into the table, but database commit wouldn't be done (yet, until you really decide to commit (or not - in that case, no values would be visible in the table)). Therefore, a view option *would* work.

I didn't understand what happened when you tried to update summary fields manually; how did you do that? In a multi-record block, you'd have to loop through all records and sum these values up. Plus, you might need to SELECT existing values from the database and add that to the summary value.
Re: How do you use a created table in a data block? [message #583560 is a reply to message #583559] Wed, 01 May 2013 15:29 Go to previous messageGo to next message
Grime
Messages: 3
Registered: May 2013
Junior Member
Trying to do it manually turned into a very big mess. Started by just going through and changing the datablock which made everythign flicker. Then created a binary index to work with, solved the flickering, but when the user added and deleted items from it was causing a bit of a head ache.

Sending the data up without a commit is kinda genius, then the view would work very well, however, man I'm no database guru, but that seems like your playing with fire.
I appreciate your time.
Re: How do you use a created table in a data block? [message #583566 is a reply to message #583560] Wed, 01 May 2013 17:23 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Just use post. It's the safe and simple way of doing what you need.
Previous Topic: How to print & in Title
Next Topic: calling a website in a form using hyperlink
Goto Forum:
  


Current Time: Fri Apr 19 08:37:40 CDT 2024