manually fill prodataset

Posted by Freddy Boisseau on 03-Sep-2008 15:01

Because of what I am doing I have to manually fill a dynamic prodataset. Since I could have a dataset that represents a parent/child relationship, so I only want to load one instance of the parent record. Is there away I can check to see if the parent record exist in the dataset already using the data-source-rowid attribute?

All Replies

Posted by jtownsen on 03-Sep-2008 17:37

According to the 10.1C docs, data-source-rowid is both readable and writable, so there'd be no problem filling the value in yourself. It may be that doing a buffer-copy will fill it in for you, but I don't have time to test this right now.

Posted by Freddy Boisseau on 04-Sep-2008 10:10

My question is not if the data-source-rowid is filled. I know that it is when you do a buffer-copy with an attached data source. What I need to do is basically the following: find first where :data-source-rowid = :rowid.. Is it possible to do this and if so how? I know I can add a field to hold the rowid in the table, and if necessary I will, but it seem to be a duplication of effort if the value is already attached to the record.

Posted by Freddy Boisseau on 04-Sep-2008 10:54

Okay, I have done some more testing and investigating. From what I can tell to do what I want to do I will need to add a field to hold the rowid of the source buffer. Now I am trying to figure out how I map the rowid of the source buffer to the field I created in the temp-table. Can someone provide a less cryptic example then what is in the OE documentation?

Thank you.

Posted by Tim Kuehn on 04-Sep-2008 11:00

How I did it.

Define a field in your TT as type ROWID (in my case it was db-table-rowid)

then a data source like so:

DEFINE DATA-SOURCE dsrc-blcode-effective

FOR QUERY q-blcode-effective

blcode-effective KEYS(ROWID)

.

then in the "attach" statement:

BUFFER pdstt-blcode-effective:ATTACH-DATA-SOURCE(

DATA-SOURCE dsrc-blcode-effective:HANDLE,

"db-table-rowid,ROWID(blcode-effective)").

Posted by Freddy Boisseau on 25-Sep-2008 12:49

I just wished I did not have to create the rowid field in the table, since there is an attribute on the buffer handle that holds that information.

Posted by Tim Kuehn on 26-Sep-2008 06:52

IIRC, 10.1C can track by ROWID w/out having to use a table field.

Posted by Freddy Boisseau on 29-Sep-2008 08:47

Yes, but that value is only accessible if you have a data-source attached. If you do not have a data-source, for example on a client with no database access, attached you can not access that field. I do not see why that field could not stay active weather the data-source is attached or not.

Posted by jtownsen on 29-Sep-2008 11:46

I guess that's because it'd directly related to the data-source. If you connected a data-source which is actually a different database, the rowids would be wrong.

...but that's just a guess

This thread is closed