Re: differentiating barcode data from keyboard entry

From: siva_1959 <Sivakumaran.ayavoo_at_gmail.com>
Date: Fri, 04 Mar 2016 07:17:45 -0600
Message-ID: <TOqdnXcQWqFkF0TLnZ2dnUU7-LvNnZ2d_at_giganews.com>


How to distinguish a data captured in a form is from manual input or barcode scanner interface.

Usually barcode scanner is used for capturing data in a form like Library, Departmental store applications etc.

The User sometimes makes a manual key-in data for the field or data captured through barcode interface. The manual entry may be wrong due to human errors but barcode scanner interface will be right always. So it is necessary to differentiate in the programming level itself and make necessary field to insert data in the underlying table.

To distinguish the data whether it is from manual entries or barcode scanner the following procedure has been followed in oracle forms6i and achieved the result.

 WHEN-NEW-ITEM-INSTANCE
 Begin

       select to_char(sysdate,'HH:MM:SS') into :global.cursor_in_time from dual;  end;

 KEY-NEXT-ITEM
 Begin

       select to_char(sysdate,'HH:MM:SS') into :global.cursor_out_time from dual; end;

In the Save Button as you designed :


WHEN_BUTTON_PRESSED



Declare
      data_passing_from_time number(5)    :=  0;     -- in seconds
      data_passing_to_time      number(5)    := 0;     -- in seconds
      passing_duration             number(5)    :=  0;     -- in seconds
      usr_id                              varchar2(20) :=  null;

Begin
      if :system.form_status = 'CHANGED' then

--
-- Conversion to Hours to Minutes + Minutes and total Minutes to Seconds + Seconds ..
--
data_passing_to_time := ((to_number(substr(:global.cursor_out_time,1,2)) * 60) + to_number(substr(:global.cursor_out_time,4,2))) * 60) + to_number(substr(:global.cursor_out_time,7,2)); data_passing_from_time := ((to_number(substr(:global.cursor_in_time,1,2)) * 60) + to_number(substr(:global.cursor_in_time,4,2))) * 60) + to_number(substr(:global.cursor_in_time,7,2));
--
-- Now we can get the passing duration in Seconds of the Scanner / Manual Entry.
--
passing_duration := data_passing_to_time - data_passing_from_time;
--
-- If you want to see the passing duration, put in message .. other-wise put -- before message ..
--
message('Passing Duration : '|| passing_duration||' secs');
--
-- We can conclude the data read by the Scanner would be 1 or 2 seconds
-- otherwise we could easily conclude the data entered by manually.
--
select user into usr_id from dual; :USER_ID := usr_id||'-'||passing_duration||' secs'; commit_form;
--
-- The information saved into the concern database for later use.
--
end if;

end;

Sivakumaran

--


Sivakumaran
--
Received on Fri Mar 04 2016 - 14:17:45 CET

Original text of this message