Sunday, December 30, 2018

Tuesday, December 18, 2018

NFI and FFI Difference

NFI(Native Function Integration) programming code for application has been created in native(android application).we can access through the native package to  Kony. (like predefined Program).

AAR if a full package with UI


all widget created in Kony as like JSON obj.


FFI (Foreign Function Integration) jar contains functionality.we have to insert it in kony third-party  integration.
https://basecamp.kony.com/s/article-detail/a046A00000CbHMIQA3/support-for-nfiffi-in-kony-visualizer

Thursday, December 13, 2018

Calender widget Validation

//Type your code here
function SdateLoad(){


  var today = new Date();
  var dd = today.getDate();
  var mm = today.getMonth()+1; //January is 0!
  var yyyy = today.getFullYear();

  if(dd<10) {
    dd = '0'+dd;
  }

  if(mm<10) {
    mm = '0'+mm;
  }
  frmHome.Calone.validEndDate =  [dd,mm,yyyy];
  frmHome.calTwo.validStartDate = [dd,mm,yyyy];
  frmHome.calThree.validStartDate = [dd,mm,yyyy];
  frmHome.Calfour.dateComponents = [dd,mm,yyyy];
}


function SdateproperOneOnSelection(evenobj){
  alert("Selected date" + evenobj.day + "/" + evenobj.month + "/" + evenobj.year);
}


function SdateproperThreeOnSelection(evenobj){
  frmHome.Calfour.validStartDate = [evenobj.day, evenobj.month, evenobj.year];
  frmHome.Calfour.dateComponents = [evenobj.day, evenobj.month, evenobj.year];
}

function doreset(){
  var today = new Date();
  var dd = today.getDate();
  var mm = today.getMonth()+1; //January is 0!
  var yyyy = today.getFullYear();

  if(dd<10) {
    dd = '0'+dd;
  }

  if(mm<10) {
    mm = '0'+mm;
  }
  frmHome.Calone.dateComponents =  [dd,mm,yyyy];
  frmHome.calTwo.dateComponents = [dd,mm,yyyy];
  frmHome.calThree.dateComponents = [dd,mm,yyyy];
  frmHome.Calfour.dateComponents = [dd,mm,yyyy];
}


Sunday, December 9, 2018

Wednesday, December 5, 2018

Without contract / with contract in components

1) Masters 1.0 (Now deprecated)
  • No controllers
2) Components without contract
  • Always has controller
  • Instances always show complete widget hierarchy as in source
  • No custom events
  • All properties can be overwritten in instance
3) Components with contract
  • Always has controller
  • Instance doesn't show any hierarchy (unless explicitly exposed)
  • Custom events
  • Control over what properties can be overwritten in instance (by making them pass-through)

So if you want to build you own calculator component and expose selected custom events for any user, you should choose components with contract.

Tuesday, December 4, 2018

How to take IOS build in kony






 How to take ios build in Xcode (Kony) ?

1.Take IOS build (KAR file is generated).
2.Add latest plugins from visualizer (path:  visualizer ->open file location -> plugins -> search(ios plugin and copy)).
3.Transfer plugins(we get plugins as JAR file [Rename as .Zip]) and KAR file in one folder.
4.Zip file should be extracted we get one more Zip file(Extract it) .Now we get gen file.
5.Open terminal 1.cd ( Drag gen file).
                2.perl extract.pl ( Drag KAR file).

6. We get Executable VM project file(Double click it).
7.Set as Krelease and generic ios build.


Monday, December 3, 2018

Segment expandable view single row only open at the time sample

var gblHfd ="";
function onrowclickofseg(){
  var cisshow;
  var selectedIndex= frmQA.Seg.selectedRowIndex[1];
  if(frmQA.Seg.selectedRowItems[0].flxQA2.isVisible === true){
    cisshow = false;
    //gblHfd = "";
  }else{
    cisshow = true;
    //gblHfd = selectedIndex;
  }
  if(gblHfd !== ""){
    var obj1 = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:false},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
    frmQA.Seg.setDataAt(obj1,gblHfd,0); 
    var obj2 = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
    frmQA.Seg.setDataAt(obj2,selectedIndex,0);
  }else{
    var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
    frmQA.Seg.setDataAt(obj,selectedIndex,0);
  }
  if(cisshow === true){
    gblHfd = selectedIndex;
  }else{
    gblHfd = "";
  }
}

Saturday, December 1, 2018

How to create SQLite Database & access with in Kony



Before refer below code check: SQLite_App its easy to understand
/*****************************************************************
Name    : createDB
Purpose : To create the database with employee_details table
 ******************************************************************/
function createDB() {
    webSQLFlag = 1;
    baseObjectId = kony.db.openDatabase("webSqlDB",
        "1.0",
        "Sample SQL Database",
        5 * 1024 * 1024); // 5MB database

    kony.db.transaction(baseObjectId,
        createTable,
        commonErrorCallback,
        commonVoidcallback);

}


/*****************************************************************
Name    : createTable
Purpose : To create emp_details table with 4 rows
 ******************************************************************/
function createTable(dbId) {
    var sqlStatement = "DROP TABLE IF EXISTS emp_details";
    kony.db.executeSql(dbId,
        sqlStatement,
        null,
        success_dropTable,
        commonErrorCallback);

    var sqlStatement = "CREATE TABLE IF NOT EXISTS emp_details (empid REAL PRIMARY KEY,empname TEXT,depid REAL)";
    kony.db.executeSql(dbId,
        sqlStatement,
        null,
        success_createTable,
        commonErrorCallback);
}



/*****************************************************************
Name    : commonErrorCallback
Purpose : To display error message on the console
 ******************************************************************/
function commonErrorCallback(transactionId, error) {
    kony.print(" Error code:: " + error);
    kony.print(" Error message:: " + error.message);
}


/*****************************************************************
Name    : commonVoidcallback
Purpose : To display success message on the console.
 ******************************************************************/
function commonVoidcallback() {
    kony.print("The transaction was executed successfully.");
}


/*****************************************************************
Name    : success_dropTable
Purpose : To display a message on the console when table creation is unsuccessful.
 ******************************************************************/
function success_dropTable(transactionId, resultset) {
    kony.print("Table was dropped");
}


/*****************************************************************
  Name    : Transaction
  Purpose : To open a transaction on click of Add button.
 ******************************************************************/
function transaction() {
    baseObjectId = kony.db.openDatabase("webSqlDB",
        "1.0",
        "Sample SQL Database",
        5 * 1024 * 1024);

    kony.db.transaction(baseObjectId, insertTable, commonErrorCallback, commonVoidcallback);
}


/*****************************************************************
  Name    : insertTable
  Purpose : To insert row in the table
 ******************************************************************/
function insertTable(dbId) {
    var empID = MainForm.IDTextBox.text;
    var empName = MainForm.NameTextBox.text;
    var depID = MainForm.DepartmentTextBox.text;
    var sqlStatement = "INSERT INTO emp_details VALUES (" + empID + ",\"" + empName + "\"," + depID + ")";

    kony.db.executeSql(dbId,
        sqlStatement,
        null,
        success_insertTable,
        commonErrorCallback);


    var sqlStatement = "SELECT * FROM emp_details";
    kony.db.executeSql(dbId,
        sqlStatement,
        null,
        success_sqlSelect,
        commonErrorCallback);

    ListForm.show();
}
/*****************************************************************
  Name    : success_insertTable
  Purpose :alert of successfully inserted table
 ******************************************************************/

function success_insertTable(transactionId, resultset) {
    kony.print("Insert is done successfully");
}


/*****************************************************************
  Name    : success_sqlSelect
  Purpose : To show all the rows of 'emp_details' table in the form
 ******************************************************************/
function success_sqlSelect(transactionId, resultset) {
    var dataObj1;
    //logic to process the resultset
    for (var i = 0; i < resultset.rows.length; i++) {
        var rowItem = kony.db.sqlResultsetRowItem(transactionId, resultset, i);
        kony.print(" empname:" + rowItem.empname);

        dataObj1 = {
            empID: rowItem.empid,
            empName: rowItem.empname,
            depID: rowItem.depid,
        };



        ListForm.Segment01.addDataAt(dataObj1, i);
    }
}
/*****************************************************************
  Name    : success_createTable
  Purpose : To display a message when table creation is successful.
 ******************************************************************/

function success_createTable(transactionId, resultset) {
    kony.print("Table is created successfully");
}