Home » Developer & Programmer » Forms » How to populate this non db block please ?
How to populate this non db block please ? [message #581334] Thu, 04 April 2013 11:35 Go to next message
somegirl
Messages: 19
Registered: March 2013
Junior Member
http://i1059.photobucket.com/albums/t423/enchanted38/form.jpg

Record 1 with label A fetches fields name1 & address1 from table 'emp'
and Record 2 with label B fetched fields name2 & address2 from same table 'emp'

I want to use a non db block to populate these records. Any help please how to write such a procedure to do so ?

Thanks.

[Updated on: Thu, 04 April 2013 11:37]

Report message to a moderator

Re: How to populate this non db block please ? [message #581337 is a reply to message #581334] Thu, 04 April 2013 12:28 Go to previous messageGo to next message
joy_division
Messages: 4544
Registered: February 2005
Location: East Coast USA
Senior Member
Either use a view of a self-join or fake it by making a non-repeating block and just hardcoding where clauses for each field.
Re: How to populate this non db block please ? [message #581338 is a reply to message #581337] Thu, 04 April 2013 12:37 Go to previous messageGo to next message
somegirl
Messages: 19
Registered: March 2013
Junior Member
Can you please explain in more details please ? Thanks.
Re: How to populate this non db block please ? [message #581339 is a reply to message #581338] Thu, 04 April 2013 15:11 Go to previous messageGo to next message
joy_division
Messages: 4544
Registered: February 2005
Location: East Coast USA
Senior Member
Don't use a repeating block and rename the fields to unique identifiers.
However, this is a poor design to being with and I am only making it worse, but it does indeed fit your request.

select name1, name2, addess1, address2, etc.
into :name_1, :name_2, :address_1, :address_2, etc.
from table
where clause


Where clause must of course only return one row.

I'll repeat it again, this is a poor design and I see no reason why you would want to do something like this. Your table seems to be denormalized and you are just trying to hide/bandage it up with method.
Re: How to populate this non db block please ? [message #581340 is a reply to message #581339] Thu, 04 April 2013 15:42 Go to previous messageGo to next message
Littlefoot
Messages: 19777
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How about a loop, for example
begin
  for cur_r in (select name, address from emp) loop
    :block.name := cur_r.name;
    :block.address := cur_r.address;
    next_record;
  end loop;
end;

That *might* work if you want to retrieve records from a table that has NAME and ADDRESS columns. However, if Quote:

Record 1 with label A fetches fields name1 & address1 from table 'emp'
and Record 2 with label B fetched fields name2 & address2 from same table 'emp'

means that this table contains all these columns (NAME1, ADDRESS1, NAME2, ADDRESS2, ...), then it, of course, won't work.
Re: How to populate this non db block please ? [message #581341 is a reply to message #581340] Thu, 04 April 2013 22:35 Go to previous messageGo to next message
somegirl
Messages: 19
Registered: March 2013
Junior Member
This won't work as I columns (NAME1, ADDRESS1, NAME2, ADDRESS2, ...)


[EDITED by LF: removed unnecessary quote of the whole previous message]

[Updated on: Fri, 05 April 2013 01:11] by Moderator

Report message to a moderator

Re: How to populate this non db block please ? [message #581361 is a reply to message #581341] Fri, 05 April 2013 01:11 Go to previous messageGo to next message
Littlefoot
Messages: 19777
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So it appears that Joy Division understood the question better than I did (which is bad news for you).
Re: How to populate this non db block please ? [message #581414 is a reply to message #581361] Sat, 06 April 2013 00:59 Go to previous message
somegirl
Messages: 19
Registered: March 2013
Junior Member
LOL , it's ok . I am thinking of creating a package in the db and then calling it in forms .. So this is solved Smile Thanks .
Previous Topic: Form
Next Topic: how to make button visibleproperty false by clicking on it
Goto Forum:
  


Current Time: Mon Nov 24 16:33:30 CST 2014

Total time taken to generate the page: 0.41333 seconds