Hi,

Users should be able to insert, delete and query records in every grid. Currently i do this with an actions menu for every grid. For example: in a master-detail-detail the master and details each have an action menu. That looks a little bit stupid: 3 action menu's. Why not one at the top of the screen. Indeed - just like Oracle Forms.

I can not figure out how to do that because i run into a problem... When the user clicks in one of the grids and clicks "insert record" in the generic action menu, i want that new record to appear in that specific grid.

The question now is: how can i determine in which grid the user is working?

Probably there is an api but the only one i can find is api_application.getfocusedcomponent. And that always returns the name of the panel of the generic actions.

Does anyone have a solution for this?

Kind regards, Jan Willem Vermeer

asked 09 Sep '15, 11:31

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1431436
accept rate: 0%


Hi Jan,

I hava no solution for your generic idea, but what's wrong about using one action for each insert activity?

Maybe you can handle it like this: - Create one common create-procedure in your package: "createRow(p_datasource name in varchar2)" - create three sub-procedures ("creMaster", "creMasterDetail", "creMasterDetailDetail") in this package, which pass the corresponding datasource name to the procedure "createRow" - create three actions "creMaster", "creMasterDetail", "creMasterDetailDetail" to the corresponding procedures

I tried to find another way. My intention was to add a listener-event to panel/datasource which notices the clicked/fetched current datasource. But this does not work.

Kind regards Florian

link

answered 10 Sep '15, 03:14

flosen's gravatar image

flosen
174
accept rate: 0%

Thanks Florian,

i think i have found a solution.

I have added the event "focusGain" to every grid and that calls a procedure to set a global variable.

When i click a generic button, i read the value from the global variable. Thusfar i have not seen problems with this method.

Kind regards,

Jan Willem

link

answered 10 Sep '15, 04:03

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1431436
accept rate: 0%

Hi Jan,

Yes, this is what I was going to suggest, too.

I also opened an internal ticket so that we can explore if it is possible to create a new API which returns the current Formspider Object the cursor is in.

Kind Regards,
Yalim

(10 Sep '15, 06:35) Yalim Gerger ♦♦

Hi all,

i run into a serious issue...

After many discussions i had decided to build a generic toolbar. To detect the current datasource, i use event "focusgain". That worked perfectly.... Until i ran into empty datasources.

Now i have the situation of a master-detail form on one page and both datasources are empty. When i press "New Row" in the generic toolbar, there is no current datasource because focusgain only works on rows.

Did anyone find out a solution for this problem?

Or is there no solution and is that the reason why it is necessary to use separate toolbars for each datasource?

Kind regards, Jan Willem

link

answered 23 Sep '15, 02:38

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1431436
accept rate: 0%

Hi,

Always check whether you have a valid datasource on the focused item. If yes, store it in session variable. Your session variable will always have last focused valid datasource.

Function that check whether your datasource is valid:

FUNCTION isds (p_ds VARCHAR2)
      RETURN BOOLEAN IS
   l_val varchar2(100);
   BEGIN
      IF p_ds IS NULL THEN
         RETURN FALSE;
      END IF;

      l_val   := api_datasource.getid (p_ds);
      RETURN TRUE;
   EXCEPTION
      WHEN api_exception.e_invaliddatasourcename THEN
         RETURN FALSE;
   END;

Hope this helps.

Regards,

George.

link
This answer is marked "community wiki".

answered 23 Sep '15, 04:41

grajan777's gravatar image

grajan777
1011238
accept rate: 10%

Thanks George.

I am using a session variable with the focused datasource and that works perfectly as long as it is possible to use focusgain to detect in which datasource the user clicks.

My problem now is that i have two empty (!) datasources on one form. Users can never click in an empty datasource. So, the focusgain event is never fired and the session variable is empty. When i press button "new row", it needs to know where to create a new row. But there is no way to figure that out.

I can only think of two solutions:

1) Limit the number datasources on one page to 1. You can not use master-detail forms anymore, so for me this will not work.

2) Make sure that every datasource shows at least one row. When the datasource is empty, that should be an empty row. But that will make the datasource dirty and lead to problems during commit.

If you have a 3rd option that will always work, i am happy to hear. I do not yet know all formspider tricks, but can not imagine that there is a work-around for this. A challenge for all experienced developers :)

Kind regards, Jan Willem

link

answered 23 Sep '15, 05:04

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1431436
accept rate: 0%

Hi Jan,

Check the Force Current Row property of the datasource. You will always get an empty row for that datasource. Here you have a way to fire focusgain event. You will not have a dirty datasource.

I am using master-detail-detail setup in the same visible page without a problem.

Regards, George.

link

answered 23 Sep '15, 05:33

grajan777's gravatar image

grajan777
1011238
accept rate: 10%

Hi George,

thanks ! I did not know this feature. Indeed the datasources now always show an empty row and when i click in it, focusgain is fired so i know where i am.

But this leads to a new challenge: when i press "new row" the api api_datasource.createRow is called and that creates a second new row... Is there an api to check if there is already an empty row shown? There is a constant row_status_new but i can not find an api to use that.

Kind regards, JW

link

answered 23 Sep '15, 06:34

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1431436
accept rate: 0%

Aha, found...

if api_datasource.getRowStatus('datasource-name') = api_datasource.row_status_temp
then
-- This is already a new record
  l_row_id := api_datasource.getCurrentRowid('datasource-name');
else
-- Create a new record  
  l_row_id := api_datasource.createRow('datasource-name');
end if;

Or is there a better solution?

KR JW

link

answered 23 Sep '15, 06:45

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1431436
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×85
×4

Asked: 09 Sep '15, 11:31

Seen: 1,476 times

Last updated: 23 Sep '15, 06:45


© Copyright Gerger 2017