NetTalk Central

Author Topic: Phone app, Javascript, Database functions  (Read 3687 times)

Amer

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Phone app, Javascript, Database functions
« on: May 01, 2020, 08:21:33 AM »
I’m trying to create phone project.    
It should be looks like fixed assets inventory in few steps:
Fill denormalized table on server from original assets table
Sync on phone
On memory form,with barcode reader to find existing asset and display their description on another “description” field. If it exists to update “found ” column, if not to add another row in assets table.

Problem is of course with javascript . On Scanner tab I would like to call javascript function
‘clicked(locEAN)’.
Is there any javascript example with comments on implementing database commands
idbAdd, idbPut,idbGet , etc .
 Point is that locEAN is member of UniqueKey KlocEAN , not GUID column.
 In all definitions of database functions , only GUID column is mentioned.

I would like to have  Clarion “like” commands:
open, close, set, get, add, put,delete .

Any help?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Phone app, Javascript, Database functions
« Reply #1 on: May 02, 2020, 04:06:49 AM »
Hi Amer,

I don't have any examples of that offhand, but there are a bunch of idb javascript functions you can call. Perhaps this is a good question for Thursday's webinar where I can walk you through the process. Join, and ask me the question there.

cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Phone app, Javascript, Database functions
« Reply #2 on: May 03, 2020, 12:50:52 AM »
Hi Bruce,
If Amer does not follow up on this, I would like to take his place on this.
Rene
Rene Simons
NT14.14

Amer

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Phone app, Javascript, Database functions
« Reply #3 on: May 04, 2020, 06:24:20 AM »
I agree with that. You have more experience on forum.

BTW, after some  time I got some "result" after Get, realized with idbGetBy (nt-idb.js) .

function Buttonclick(locean){
   idbOpen(database);
   let x=locean;    //"02400"
   database.xinvent.record.eankod =locean ;     //"02400";
   idbGetBy(database,database.xinvent,"eankod",x,   
      function(){ // got record         
         $("#locdescription").val(database.xinvent.record.description);

         $("#locdescription").change();
      }
   );
};
This is a first part. It works only  with fixed value (  "02400") , but not with locean . It has to be passed parameter , called with button OnClick as
'Buttonclick(locean)' . locean is a form string field.
In Chrome source I get:
x = input#locean.nt-entry.ui-corner-all {jQuery341069521962941633861: {…}, accept: "", alt: "", autocomplete: "off", defaultChecked: false, …}, locean = input#locean.nt-entry.ui-corner-all {jQuery341069521962941633861: {…}, accept: "", alt: "", autocomplete: "off", defaultChecked: false, …}

Also, I saw that idbGetBy is a special case of idbSelect, and their options: to, equal, limit ...
More about that.
With explaining of nt-idb.js, phone projects, will not more exist a a problem.


Amer