Can't get new foundset

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Can't get new foundset

Postby bobm » Thu Sep 22, 2016 2:37 pm

I have new records I need to add to an existing table. Below is the code to do so, but when I run it I get the message "Can't get new foundset for: db:/diagnosis_procedure/diagsnew"
What am I missing here? In developer when I select the fields to import the "record. " is displaying all fields in this database/table as it should. I am using Version: 6.1.2 - build 1421
Code: Select all
/**
* @properties={typeid:24,uuid:"9B724F9C-283F-4398-BFFA-7176AF081F9B"}
*/
function migratenewdiagnosis(){
   /** @type {JSFoundSet<db:/diagnosis_procedure/diagsnew>} */
   var newdx = databaseManager.getFoundSet('diagnosis_procedure','diagsnew');
   newdx.loadAllRecords();
   
   /** @type {JSFoundSet<db:/eyecor/diagnosis>} */
   var diagnosis = databaseManager.getFoundSet('eyecor','diagnosis');
   diagnosis.loadAllRecords();
   
   for(var i = 1; i<=newdx.getSize(); i++ ){
      var record = newdx.getRecord(i);
      if(diagnosis.newRecord()){
         diagnosis.code = record.codeicd10;
         diagnosis.description = record.description;
         diagnosis.alt_terms = record.altterms;
         diagnosis.pearls = record.pearls;
         diagnosis.flag_medical = 1;
         diagnosis.code_type = "ICD10";
         diagnosis.codingtips = record.codingtips;
         diagnosis.notes = record.notes;
      
      }   
   }
}

Thank you,
Bob
Bob Mezzadri
EyeCOR By Nteon
bobm
 
Posts: 81
Joined: Thu Dec 29, 2011 8:24 pm

Re: Can't get new foundset

Postby bobm » Thu Sep 22, 2016 3:42 pm

I figured out the issue -
the new table I was pulling from did not have a PK set.
Once a PK was set everything imported as it should.
Bob Mezzadri
EyeCOR By Nteon
bobm
 
Posts: 81
Joined: Thu Dec 29, 2011 8:24 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 8 guests