When I trying to change value of Department using combobox (http://theformspider.com/learningcenter/tutorial-4-how-to-build-a-combobox/) it update all rows this the value I choose before. I put a 'save' button assained to save procedure: procedure save is begin api_application.doCommit; end; How can solve this problem and update only 1 row that I choose?

asked 04 Dec '12, 05:24

Emil's gravatar image

accept rate: 0%

edited 04 Dec '12, 10:34

oskansavli's gravatar image

oskansavli ♦♦

Hi Emil,

In Formspider, there is not a built-in API committing changes in a single row existing in a datasource, you can either commit all rows in a single datasource or in a group datasources using api_datasource.doCommit API or you can commit all datasources existing in the application using api_application.doCommit API.

In your case, you can create a new datasource definition based on Employees table retrieving data for a single employee. You can reflect the changes made on the grid row to be committed to this single row datasource and commit it through the api_application.doCommit API.

If it doesn't help, can you please give details about your usecase?

Regards, Ibrahim


answered 04 Dec '12, 06:01

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
accept rate: 25%

Can I do this with setValue and getValue in sql update command and then commit this change? if yes then how must I code it?

(04 Dec '12, 06:10) Emil

Hi Emil,

Committing the changes in sql update is doable but we strongly do not recommend this implementation. You can achieve your goal with the following;

  • Create a new datasource deginition named "EMPLOYEEBYID", based on "EMPLOYEES" table. Enter "`EMPLOYEE_ID = :employee_id`" as its where clause and create a bindvariable named "employee_id" with "DefaultNumber" as domain.
  • Use the following save procedure to commit changes made on the current row of your grid:
procedure save is
  v_employee_id number;
  v_row_t       api_datasource.tt_row;
  -- if the row is updated
  if api_datasource.getrowstatus('EMPLOYEES1') =  api_datasource.ROW_STATUS_UPDATED then
    --get current grid row
    v_row_t := api_datasource.getRow('EMPLOYEES1');
    -- execute single row datasource
    api_datasource.setbindvar('EMPLOYEEBYID1.employee_id', v_row_t('EMPLOYEE_ID').value_nr);

    -- apply changes to single row datasource
    api_datasource.setcolumnvalue('EMPLOYEEBYID1.DEPARTMENT_ID', v_row_t('DEPARTMENT_ID').value_nr);
    api_datasource.setcolumnvalue('EMPLOYEEBYID1.FIRST_NAME', v_row_t('FIRST_NAME').value_tx);
    -- commit changes
    -- refresh grid row
  end if;

Regards, Ibrahim

(04 Dec '12, 10:27) Ibrahim Sand... ♦♦
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: 04 Dec '12, 05:24

Seen: 2,271 times

Last updated: 04 Dec '12, 10:36

© Copyright Gerger 2017