Hello FS Team,

after we solved the issue described here http://osqa.theformspider.com/questions/1740/master-detail-form-create-new-record-error

we faced another one: when we try to create new record we get "Datasource "ds_name" has no current row." error. we try to create new row using the "createPers" procedure. First we create the row of the master table. After that we are trying to create the corresponding rows of the detail tables. Here is the procedure code (I will send the entire package code with app xml export to email as well):

  procedure createPers is
v_row_id  number;
v_pers_id number;
v_rtip_id number;
v_rnap_id number;
v_intr_id number;
v_dprt_id number;
v_tick_id number;
    select pers_seq.nextval into v_pers_id from dual;
    api_datasource.setColumnValue('SB_PERS1.PERS_ID', v_pers_id, v_row_id);
    if api_session.getValueTX('FORM') = 'ZADERJPASS' then
        api_datasource.setColumnValue('SB_PERS1.PERS_CLASS', 1, v_row_id);
        select rtip_seq.nextval into v_rtip_id from dual;
      v_rnap_id := null;
      api_datasource.setColumnValue('SB_RTIP1.RTIP_ID',      v_rtip_id, v_row_id);
      api_datasource.setColumnValue('SB_RTIP1.RTIP_PERS_ID', v_pers_id, v_row_id);
    else   -- DEPORTPASS
      api_datasource.setColumnValue('SB_PERS1.PERS_CLASS', 0, v_row_id);
      select rnap_seq.nextval into v_rnap_id from dual;
      v_rtip_id := null;
      api_datasource.setColumnValue('SB_RNAP1.RNAP_ID',      v_rnap_id, v_row_id);
      api_datasource.setColumnValue('SB_RNAP1.RNAP_PERS_ID', v_pers_id, v_row_id);
    end if;
    select intr_seq.nextval into v_intr_id from dual;
    api_datasource.setColumnValue('SB_INTR1.INTR_ID',      v_intr_id, v_row_id);
    api_datasource.setColumnValue('SB_INTR1.INTR_PERS_ID', v_pers_id, v_row_id);
    api_datasource.setColumnValue('SB_INTR1.INTR_RTIP_ID', v_rtip_id, v_row_id);
    api_datasource.setColumnValue('SB_INTR1.INTR_RNAP_ID', v_rnap_id, v_row_id);
    select dprt_seq.nextval into v_dprt_id from dual;
    api_datasource.setColumnValue('SB_DPRT1.DPRT_ID',      v_dprt_id, v_row_id);
    api_datasource.setColumnValue('SB_DPRT1.DPRT_PERS_ID', v_pers_id, v_row_id);
    api_datasource.setColumnValue('SB_DPRT1.DPRT_RTIP_ID', v_rtip_id, v_row_id);
    api_datasource.setColumnValue('SB_DPRT1.DPRT_RNAP_ID', v_rnap_id, v_row_id);
    select tick_seq.nextval into v_tick_id from dual;
    api_datasource.setColumnValue('SB_TICK1.TICK_ID',      v_tick_id, v_row_id);
    api_datasource.setColumnValue('SB_TICK1.TICK_PERS_ID', v_pers_id, v_row_id);
    api_datasource.setColumnValue('SB_TICK1.TICK_SER_NUM', '12345', v_row_id);
    api_datasource.setColumnValue('SB_SERV1.SERV_PERS_ID', v_pers_id, v_row_id);

Could you please specify what is incorrect in this code which causes "Datasource "ds_name" has no current row." error?

Many thanks in advance,


asked 05 Jul '13, 05:59

anatoly4u's gravatar image

accept rate: 0%

edited 05 Jul '13, 06:06

sent details to contact at theformspider com

(05 Jul '13, 06:06) anatoly4u

Hi Anatoly,

I agree with Michiel's suggestion below. It looks like your datasource does not have a current row. In this case, you can set it by calling the API api_datasource.setCurrentRow. It has four flavors as you can see in the API documentation. http://theformspider.com/API/index.html

Please keep in mind that, every time you run the api_datasource.executeQuery() API, the current row of the datasource you reference in the API call is set to the 1st row in the retrieved set of rows. If no rows are retrieved, then the current row is null.

Let me know if this helps. If it doesn't, I'll try to run a few tests with the code you sent.

Kind Regards,

(05 Jul '13, 08:01) Yalim ♦♦

thanks, will try and return with results after weekend

(05 Jul '13, 10:15) anatoly4u

Hello, seems the issue was on our side. The reason we got that error was that we had an "on row change" trigger which executed the populate detail procedure. Therefore when creating new record it tried to find the detail row before it was created.

(09 Jul '13, 05:17) anatoly4u

Hi Anatoly, Happy to hear that the issue was resolved. :-)

(09 Jul '13, 05:18) Yalim Gerger ♦♦

Hi Anatoly,

Although i did not test your code, you can try setting a row as current row after you create it. After inserting a new row, you can set it as current row using api_datasource.setcurrentrowbyid. This will make sure the newly created row in the datasource is the current one.

Maybe that will help prevent the error.

Best regards, Michiel A.


answered 05 Jul '13, 06:45

Michiel%20A's gravatar image

Michiel A
accept rate: 13%

thank you, I will try that

(05 Jul '13, 10:16) anatoly4u
Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 05 Jul '13, 05:59

Seen: 996 times

Last updated: 09 Jul '13, 05:18

© Copyright Gerger 2017