Home » Developer & Programmer » Forms » How to get to the last record or refreshing a block...
How to get to the last record or refreshing a block... [message #664895] Thu, 10 August 2017 05:28 Go to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
Hi guys,

I have googled quite some time and I have tried looping all the records like,
first_record;
loop
  exit when GET_BLOCK_PROPERTY(block_name, TOP_RECORD) = l_top_rec;
  next_record;
end loop;
go_record(l_top_rec);

loop
  exit when :SYSTEM.CURSOR_RECORD = l_cur_rec or :SYSTEM.LAST_RECORD = 'TRUE';
  next_record;
end loop; 

Still it's just making modifying all the records based on the first record.

So, I have tried this,

first_record;
loop
  exit when :SYSTEM.LAST_RECORD = 'TRUE';
  next_record;
end loop;
go_record(l_top_rec);

loop
  exit when :SYSTEM.CURSOR_RECORD = l_cur_rec or :SYSTEM.LAST_RECORD = 'TRUE';
  next_record;
end loop; 
it's giving me null value in an aggregate function.

So, I have just tried execute_query followed by go_record(l_top_rec) but even that is giving me the null value in aggregate column.

So, I am out of ideas.

it would be great if you just refresh a block but if now, I wouldn't mind executing the entire query and going to that particular record.

So, can you guys help me?

Thanks in advance.
Re: How to get to the last record or refreshing a block... [message #664896 is a reply to message #664895] Thu, 10 August 2017 05:57 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm not sure I understand the question as your post mentions "aggregate column", "modifying records", ... , while topic title says "how to get to the last record".

Well, executing the LAST_RECORD built-in should get you right there.
Re: How to get to the last record or refreshing a block... [message #664897 is a reply to message #664896] Thu, 10 August 2017 06:21 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
Well my mistake. I want to execute the last query with the current record.
Re: How to get to the last record or refreshing a block... [message #664921 is a reply to message #664897] Fri, 11 August 2017 04:50 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What does that mean? Could you, please, describe it?

GET_BLOCK_PROPERTY with its LAST_QUERY property returns the last query executed in that block.

But, I don't understand what the "current record" has to do with it.
Re: How to get to the last record or refreshing a block... [message #664923 is a reply to message #664921] Fri, 11 August 2017 06:43 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
Littlefoot wrote on Fri, 11 August 2017 04:50
What does that mean? Could you, please, describe it?

GET_BLOCK_PROPERTY with its LAST_QUERY property returns the last query executed in that block.

But, I don't understand what the "current record" has to do with it.
Well, I have tried that and I saved the cursor record, to display the same record. But for some reason it's retrieving all the records based on the previous query find.

My requirement is to refresh the block. Like clear block and find all.
If that's not possible, then I would like to refresh the entire record.
Re: How to get to the last record or refreshing a block... [message #664924 is a reply to message #664923] Fri, 11 August 2017 07:02 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd say that "block" is the data block (based on a table). Therefore, once you entered values into block items and saved them, they are now stored in the database AND they are visible on the screen.

So, why are you trying to display those values using a querying mechanism?

Anyway: if there's a unique identifier for that record (such as ID), you could use it in PRE-QUERY trigger to set the criteria. First, in PRE-INSERT trigger, create the ID value
select seq_name.nextval into :global.id from dual;
:block.id := :global.id;
Then, in PRE-QUERY trigger, use that value:
:block.id := global.id;
Alternatively, you could use SET_BLOCK_PROPERTY and its ONETIME_WHERE property.
Re: How to get to the last record or refreshing a block... [message #664925 is a reply to message #664924] Fri, 11 August 2017 07:04 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
Littlefoot wrote on Fri, 11 August 2017 07:02
I'd say that "block" is the data block (based on a table). Therefore, once you entered values into block items and saved them, they are now stored in the database AND they are visible on the screen.

So, why are you trying to display those values using a querying mechanism?

Anyway: if there's a unique identifier for that record (such as ID), you could use it in PRE-QUERY trigger to set the criteria. First, in PRE-INSERT trigger, create the ID value
select seq_name.nextval into :global.id from dual;
:block.id := :global.id;
Then, in PRE-QUERY trigger, use that value:
:block.id := global.id;
Alternatively, you could use SET_BLOCK_PROPERTY and its ONETIME_WHERE property.
Due to the requirement, when the user updates stuff, the values should get refreshed.
There is no unique identifier for the record unfortunately.
Re: How to get to the last record or refreshing a block... [message #664926 is a reply to message #664925] Fri, 11 August 2017 07:08 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:

Due to the requirement, when the user updates stuff, the values should get refreshed.
OK, but *what* do you want to refresh? Values you currently see on the screen are "refreshed", aren't they?
Re: How to get to the last record or refreshing a block... [message #664927 is a reply to message #664926] Fri, 11 August 2017 07:16 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
Littlefoot wrote on Fri, 11 August 2017 07:08
Quote:

Due to the requirement, when the user updates stuff, the values should get refreshed.
OK, but *what* do you want to refresh? Values you currently see on the screen are "refreshed", aren't they?
No. It's hard to explain but the values are not consistent. So, I would like to refresh them.
Re: How to get to the last record or refreshing a block... [message #664928 is a reply to message #664927] Fri, 11 August 2017 07:22 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The only valid option to do that is to EXECUTE_QUERY on that block. It will fetch current values from the database. The only "problem" is how to restrict it (as it, basically, does "SELECT * FROM your_table" with no WHERE clause). But, as you said that you can't distinguish one record from another (and use it in PRE-QUERY or SET_BLOCK_PROPERTY), I don't know what else you could do.
Re: How to get to the last record or refreshing a block... [message #664929 is a reply to message #664927] Fri, 11 August 2017 07:49 Go to previous messageGo to next message
joy_division
Messages: 4794
Registered: February 2005
Location: East Coast USA
Senior Member
Claraviolet wrote on Fri, 11 August 2017 08:16
Littlefoot wrote on Fri, 11 August 2017 07:08
Quote:

Due to the requirement, when the user updates stuff, the values should get refreshed.
OK, but *what* do you want to refresh? Values you currently see on the screen are "refreshed", aren't they?
No. It's hard to explain but the values are not consistent. So, I would like to refresh them.
I would say so. Your explanation is terrible an no one knows what you are talking about. You might, but no one else does. Try again, and don't just repeat the same thing. I have a feeling you just do not know how forms work and are doing inserts and updates in your code when forms handles all of that inherently without any code.
Re: How to get to the last record or refreshing a block... [message #664930 is a reply to message #664928] Fri, 11 August 2017 07:50 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
Littlefoot wrote on Fri, 11 August 2017 07:22
The only valid option to do that is to EXECUTE_QUERY on that block. It will fetch current values from the database. The only "problem" is how to restrict it (as it, basically, does "SELECT * FROM your_table" with no WHERE clause). But, as you said that you can't distinguish one record from another (and use it in PRE-QUERY or SET_BLOCK_PROPERTY), I don't know what else you could do.
When I click View - > Find all in the navigation menu,what will be triggered littlefoot?
Re: How to get to the last record or refreshing a block... [message #664931 is a reply to message #664929] Fri, 11 August 2017 07:53 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
joy_division wrote on Fri, 11 August 2017 07:49
Claraviolet wrote on Fri, 11 August 2017 08:16
Littlefoot wrote on Fri, 11 August 2017 07:08
Quote:

Due to the requirement, when the user updates stuff, the values should get refreshed.
OK, but *what* do you want to refresh? Values you currently see on the screen are "refreshed", aren't they?
No. It's hard to explain but the values are not consistent. So, I would like to refresh them.
I would say so. Your explanation is terrible an no one knows what you are talking about. You might, but no one else does. Try again, and don't just repeat the same thing. I have a feeling you just do not know how forms work and are doing inserts and updates in your code when forms handles all of that inherently without any code.
Well, i have strict policies to follow. So i couldn't give more info. I apologize for that. You are right. I am totally new to forms. I know bsic stuff as it is similar to reports builder but that's about it.
Re: How to get to the last record or refreshing a block... [message #664932 is a reply to message #664930] Fri, 11 August 2017 07:56 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Which "View - Find", which "navigation menu"? Where is it? Could you post a screenshot, please?

By the way, you didn't specify which Oracle product you use (name and version).

Also, there's no need in replying with quote (unless you're referring to something specific, but quoting the WHOLE previous message is useless and only takes space).
Re: How to get to the last record or refreshing a block... [message #664933 is a reply to message #664932] Fri, 11 August 2017 07:57 Go to previous messageGo to next message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Huh, Forms is similar to Reports as much as banana is similar to potato.
Re: How to get to the last record or refreshing a block... [message #664934 is a reply to message #664933] Fri, 11 August 2017 08:45 Go to previous messageGo to next message
Claraviolet
Messages: 8
Registered: August 2017
Junior Member
https://docs.oracle.com/cd/A60725_05/html/comnls/us/fnd/menus.htm
In that document, in query menu, there is a find all option. So, what will get triggered when you select that option?
Re: How to get to the last record or refreshing a block... [message #664937 is a reply to message #664934] Fri, 11 August 2017 17:33 Go to previous message
Littlefoot
Messages: 21246
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So, it is Oracle apps. after all. I don't use that product. However, based on what text on a page whose link you posted says, I'd say thar it simply executes an unconditional EXECUTE_QUERY.
Previous Topic: HOW TO CHANGE ITEM PROPERTY FOR TABULAR
Next Topic: Forms PLL vs Forms Program Unit
Goto Forum:
  


Current Time: Fri Nov 24 23:32:06 CST 2017

Total time taken to generate the page: 0.04615 seconds