Hello there. I have two panels, one containing grid and another is singlerecord trigger filled audit data of the current row of the grid, and it is based on the same datasource. I want to get that server side genereted data on IU reflected on the data source and see them when the cursor moves from row to row in the grid panel. Although doCommit it is executed, I can't see the audit data in the second panel. How to refresh those db generated data? The same thing is with sequence generated IDs.

asked 10 Jun '14, 02:47

ddjuric's gravatar image

ddjuric
114
accept rate: 0%


Hi Dusan,

You can use api_datasource.refreshRow API to refresh the data in a datasource row.

Kind Regards,
Yalim

link

answered 10 Jun '14, 03:38

Yalim's gravatar image

Yalim ♦♦
2.8k5
accept rate: 21%

Hi Yalim. I already tried:

if API_DATASOURCE.isdirty(P_DATA_SOURCE)='Y' OR API_DATASOURCE.isdmlnecessary(P_DATA_SOURCE)='Y' THEN API_APPLICATION.DOCOMMIT(); API_DATASOURCE.refreshrow(P_DATA_SOURCE, API_DATASOURCE.getpreviouscurrentrowid(P_DATA_SOURCE)); END IF;

in the Data source Current Row Changed event.

It works fine for the Update, but insted to show data on Create refreshrow by previus rowid just clear data from the grid. I have to do API_DATASOURCE.EXECUTEQUERY(P_DATA_SOURCE) to retrieve it from DB wich I do not want to do (it changes grid record order of inserted record)

(10 Jun '14, 04:28) ddjuric

I found it very difficult to have a harmonized grid with the database data if the data source PK is server side generated. Delete is impossible without PK. I have to refresh row in data source immediately after tying to leave current row and get all of its data from DB. Process should have these steps: api_datasource.docommit(p_data_source), than get server generated data to current row, including ID and audit fields or any other server side calculations, this is BR and it is part of the robust DB paradigm. I want as less as possible middle tire or middle tire "like" behavior.

(10 Jun '14, 07:18) ddjuric

Hi Dusan,

The refreshRow API uses the value in the Primary Key column (specified in the Datasource Definition) of the datasource row to refresh it from the corresponding row in the database table/view. If you do not populate the Primary key column before you issue a doCommit, there is no way Formspider can know which row it should read from the table(view) in the database.

Kind Regards,
Yalim

(10 Jun '14, 07:18) Yalim Gerger ♦♦

Hi Dusan,

That's correct. Formspider needs to know the Primary key (or at least a column that can be used as a pseudo Primary Key.) to be able to delete and do a reFreshRow. Unfortunately, if the Primary Key is generated in the database you won't be able to achieve what you want unless you specify a pseudo Primary Key in the Datasource Definition Dialog.

Kind Regards,
Yalim

(10 Jun '14, 07:27) Yalim Gerger ♦♦

Thx Yalim. I solved the problem. In the data source event Current Row Changed I'm reading API_DATASOURCE.getpreviouscurrentrowid and if PK in that row is NULL I repopulate it with previusly entered UK filed in that row.

link

answered 11 Jun '14, 02:56

ddjuric's gravatar image

ddjuric
114
accept rate: 0%

Hi Dusan,

You are welcome. Smart solution! :-). Great to hear that you got it working.

Kind Regards,
Yalim

(11 Jun '14, 05:34) Yalim Gerger ♦♦
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:

×7
×1

Asked: 10 Jun '14, 02:47

Seen: 1,132 times

Last updated: 11 Jun '14, 05:34


© Copyright Gerger 2017