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;
begin
v_row_id:=api_datasource.createRow('SB_PERS1',api_datasource.getCurrentRowID('SB_PERS1'));
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);
v_row_id:=api_datasource.createRow('SB_RTIP1');
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);
v_row_id:=api_datasource.createRow('SB_RNAP1');
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;
v_row_id:=api_datasource.createRow('SB_INTR1');
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);
v_row_id:=api_datasource.createRow('SB_DPRT1');
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);
v_row_id:=api_datasource.createRow('SB_TICK1');
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);
v_row_id:=api_datasource.createRow('SB_SERV1');
api_datasource.setColumnValue('SB_SERV1.SERV_PERS_ID', v_pers_id, v_row_id);
api_datasource.previousRow('SB_PERS1');
end;
Could you please specify what is incorrect in this code which causes "Datasource "ds_name" has no current row." error?
Many thanks in advance,
Anatoly
asked
05 Jul '13, 05:59
viktorK
69●3●28
accept rate:
0%
sent details to contact at theformspider com
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,
Yalim
thanks, will try and return with results after weekend
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.
Hi Anatoly, Happy to hear that the issue was resolved. :-)