Tuesday, 6 February 2024

Consuming Integration Service in Temenos Visualizer

 Hello folks, today we see how to consume an Integration service from Visualizer Reference Architecture Web form application.

Follow the below step:

  1. First configure the fabric URL. In order to do so go to "Edit" in top menu. Then go to "Visualizer Preferences" and then "Fabric". Enter the Fabric URL and then "validate" 

  2. Now link the MicroApp with FabricApp in which the service has been created. To do that go to "Data & Services" tab in visualizer then go to "Link to Existing App". Then on the desired app click "Associate"
     
  3. In order to consume refer the sample code that is provided from Fabric console. Go to "Integration Service" tab in fabric console of the application and click on your service and click on "sample code" icon as shown in the image. 

  4. Now copy the sample code for the service and its operation and paste in your controller/module code. 
     

     

  5. Below is the form controller code for invoking the Integration Service and logging the response in console:  
     onPostShow: function(){           
           var serviceName = "MyTestService2";
           var integrationObj = KNYMobileFabric.getIntegrationService(serviceName);
           
           //Code to invoke parent integration service should be present to use below code.
           var operationName =  "MyTestOperation2";
           var data= {};//{"countryname": "United States"}; //sample value
           var headers= {};
           integrationObj.invokeOperation(operationName, headers, data, operationSuccess, operationFailure);
           
           function operationSuccess(res){
           // code for success call back
             console.log('operationSuccess:');
             console.log(res);
           }
           function operationFailure(res){
           // code for failure call back
             console.log('operationFailure:');
             console.log(res);
           }
         },

  6. Now run the application by first clicking "Build" menu then "Live Preview Settings". Select "Responsive Web" then click "Save & Run" 


  7. Check the output in the console window of browser


Friday, 26 January 2024

Configuring Integration Service in Temenos Fabric Console

 Hello, today we see how to configure an Integration service in Temenos Fabric Console. The Fabric console is very powerful tool such that it can connect with various types of backend services. some of the backend connecters include XML, SOAP, JSON, Java, JavaScript, Relational database. One can also set mock data with Mock data connector. Now lets go through the process of configuring an Integration service step by step.

  1. First open the console and goto the App and in the Configure Service tab press the Configure New button. 

  2. Now enter the service name by which you will later access. Select the service type, some of them I have mentioned above. You may see that I have selected as JSON as this service will return a JSON response. Enter the base url of your service. For now the web service authentication is set to none, this can also be configured for security purpose. Now press "save" or "save and add operation" 

  3. Click on the "add operation" button in operation list tab. 
     
  4. Enter the name of operation and set any url suffix that might be present in the service url that you are configuring. Here it is being set as "search?country=$countryname" where search represents the operation name and country is the parameter by which search is to be made and $countryname is the parameter value.  

  5. In the Request Input tab set the parameter countryname, here a default value is also set as "United States".  

  6. One more thing that can be configured but it is not mandatory is the output. If no output parameters are set then all the response is returned. If Response Output is set then the desired response is returned. Here country, name, alpha_two_code are being returned. The $.[*] means the array [] inside the main response $. 

  7. Now click "save and fetch response". You may see the output result. 


  8. In order to consume this service in an application it will be needed to publish the service first. 




  

Thank you for reading. Have a good day.

Wednesday, 24 January 2024

Kony Visualizer Form LifeCycle

 In Kony framework the basic unit of user interface is a form over which widgets and components are aligned. The events of form life cycle are triggered in the following order:

  1. onNavigate: This is the first event function that is invoked once a form is navigated. It is invoked automatically if it is implemented in the form controller.
  2. init: init event is invoked in second order and it is invoked only first time when a form is loaded. It initializes the form and any widgets.
  3. preShow: This event is executed in third order. It is called just before a form is visible on the screen. A form can be made visible by explicitly calling the show method of the form.
  4. postShow: postShow event is called in fourth step when form is loaded. It is called immediately after the form is visible on the screen.
Refer to the sample code below of a form controller for implementation of the above lifecycle methods:

define({ 
     init: function(){
       //2- init event is called in second step
       //Called only firsttime when form is loaded
       alert('hello world: init');
       this.view.btnClick.onClick = this.buttonClick;
     },
  
     onNavigate: function(){
       //1- onNavigate event is called in first step when form is loaded 
       //It is called automatically if implemented.       
       alert('hello world: onNavigate');
       this.view.init = this.init.bind(this);
       this.view.preShow = this.onPreShow.bind(this);
       this.view.postShow = this.onPostShow.bind(this);         
     },
     
     onPreShow: function(){
       //2- preShow event is called in third step when form is loaded
       alert('hello world: preshow');
     },
     onPostShow: function(){
       //4- postShow event is called in fourth step when form is loaded
       alert('hello world: postshow');
     },
    
     buttonClick: function(){
       var scopeObj = this;
       scopeObj.view.lblText1.text = "Hello world";
     }
 });

Monday, 15 January 2024

Useful git commands

 Introduction:

Git is widely used versioning control system with millions of lines of code maintained through it world wide. To maintain file versioning git is integrated with other systems like Github, bitbucket and others. 


Commands:

Some basic and useful commands of git include the following:

1- git status

  • To get the current status of user branch use this command git status
  • This command will tell if there are any changes in any files that need to be stage and commit
  • Staged files are files that are ready to be committed to the 
  • If there are any deleted files
  • If there are any new files added
2- git log 
  • Use this command to check the history of changes (commits) made in the current branch
  • It helps in tracking the previous work
  • Also see git log origin/<master>
  • To check logs from a specific user via its name use: git log --author="NAME"
  • To check logs from a specific user via its email use: git log --author=<email> 
3- git help
  • This command provides information related to different git commands
4- git branch
  • This command lists down all the branches that are present in locally.
  • To view only the origin (remote) branches use: git branch -r
  • To view all the branches local and remote use: git branch -a
  • To delete a local git branch use: git branch --delete <branch>
5- git branch <new-branch>
  • Use this command to create new branch locally
6- git checkout
  • Use this command to move from current branch to selected branch
  • git checkout -b <new-branch>. This will first create new branch if not exist then move to it from existing.
  • git checkout -b <new-branch> origin/<existing-branch>. This will checkout new branch from an existing remote branch.
  • git checkout <commit-id>. To checkout a specific commit.
7- git add
  • git add index.html. This command will stage file for commit.
  • git add -A or git add --all. This command will add all files to staging.
8- git commit
  • Each commit is supposed to be a change point or save point by git
  • git commit -m "<message>". This command will commit changes after staging
  • git commit -a -m "<message>". This command will commit changes without staging
9- git fetch
  • This command will fetch latest file versions from all remote branches
10- git push
  • git push origin "<branch>". This command will push local branch to remote new branch.
  • git push origin. This will push code to remote same branch.
  • git push --set-upstream origin <branch>. This command sets upstream branch for pushing code to remote repository on first time.
11- git pull
  • This command will get most recent changes of  remote branch to local copy
  • git pull origin
  • git pull origin <branch>.This will fetch a specific branch from remote and merge into the current branch.
12- git clone
  • Creates a full copy of repository in local directory
13- git revert 
  • This will take previous commit and add it as new commit
14- git reset 
  • This will move repository back to a previous commit
  • git reset <commitId>, reset to a specific commit
  • git reset --hard
  • git clean -fxd
15- git stash
  • Stashes(saves and sets aside) the work in local directory, this is typically helpful in scenario where one is not done with current work but suddenly has do something else then the current work can be stashed and later on re-applied once the second work is done.
  • git stash list. List down the stashes.
  • git stash show. Inspect the stashed items.
  • git stash apply. Restore stashed work.
16- git remote
  • git remote add origin <URL>. This command specifies a remote repository as an origin to the local Git repository.
  • git remote show origin. This command tells which local branches are tracking which remote branches.
17- git merge
  • This command is for merging the work of two branches.
  • The way to do a merge is that first checkout the branch for e.g master branch with:
  • git checkout master
  • Now merge with other branch with following command:
  • git merge <new-branch>
  • Now delete the branch with: git branch -d <new-branch>

I hope this will help you as reference while using git. Thank you and keep on reading.

Monday, 8 January 2024

Kony Visualizer Reference Architecture

 Hi folks, well this is something new to those of you are not known to kony framework or visualizer or temenos. Visualizer is the IDE used to develop form based mobile and web applications, it is owned by Temenos company which is famous worldwide for its banking related products. Reference architecture is style of development that is done in kony framework. kony framework is a collection of JavaScript modules, controller files, extensions. Refer to the image below:


In Reference Architecture development there are forms which are built for mobile or web. 

1-These forms contain widgets like label, textbox, listbox, segments and so on. A form may contain components as well. A component is a collection of widgets created with the purpose for reusability.

2- The forms business rules or validations are applied at the presentation layer which is written in presentation controller and its extension files. Presentation controllers connect the form controllers with the business controllers.

3- The business controllers connects with the repository to perform CRUD operations.

4- Repository and models are there to connect the front-end with back-end services to send/receive data. 

The back-end services are connected via Fabric which is a very powerful and secure tool for connectivity. More on Fabric some other day.

Sunday, 2 February 2020

Pivot result in T-SQL

Sometimes it is required to get query output in tabular form based on cross-tab format. There may be multiple reasons for such output like direct display to front-end, export to file or may be simple analysis. As such sql server provides PIVOT feature to accomplish this task.

Consider a case where shop keeper wants to know what were the sales of each individual item of the shop based on each individual sale invoice. Below is output of how pivot feature can give the desired result:

This is achieved with following query:


SELECT row_number() OVER (ORDER BY SalesInvoiceCode) Ser , * 
FROM   
(
select  
sim.SalesInvoiceCode,
case 
when a.ID = 1935 then isnull(c.[Description],a.Item) else a.Item 
end as [Item],

sum(isnull(c.Rate, a.SaleRate) *  isnull(c.Quantity,0)) as Sale
from ERP_SCM_INV_ITEM a
inner join ERP_MASTER_Setup_ItemNature b on b.ItemNatureID_PK = a.ItemNatureID_FK and b.ItemNature = 'posmenu'
inner join ERP_FMS_SalesInvoice_Detail c on c.ItemID_FK=a.ID
inner join ERP_FMS_SalesInvoice_Master sim on sim.SalesInvoiceID_PK = c.SalesInvoiceID_FK
inner join POS_OrderPayment pop  on pop.InvoiceId = sim.SalesInvoiceID_PK
inner join ERP_FMS_SalesInvoice_Types sit on sit.SalesInvoiceTypeID_PK = pop.DiningType

where sim.SalesInvoiceCode like '%pos%'
and cast(sim.CreatedDate as date) = '2020-01-13'  
and sim.TransactionID_FK > 0 and (sim.closed = 0 and sim.IsCancel is NULL)
and pop.FK_POS_LocationId = '1' 
group by 
case 
when a.ID = 1935 then isnull(c.[Description],a.Item) else a.Item 
end ,
sim.SalesInvoiceCode
) t
pivot(
sum(Sale)
for Item in ([Barbosa Cake],[Coffee],[Delivery Charges],[Sitting Charges]
)
)
AS pivot_table

union

SELECT NULL as Ser,* FROM
(
select  
'Total' as SalesInvoiceCode, 
case 
when a.ID = 1935 then isnull(c.[Description],a.Item) else a.Item 
end as [Item],
sum(isnull(c.Rate, a.SaleRate) *  isnull(c.Quantity,0)) as Sale
from ERP_SCM_INV_ITEM a
inner join ERP_MASTER_Setup_ItemNature b on b.ItemNatureID_PK = a.ItemNatureID_FK and b.ItemNature = 'posmenu'
inner join ERP_FMS_SalesInvoice_Detail c on c.ItemID_FK=a.ID
inner join ERP_FMS_SalesInvoice_Master sim on sim.SalesInvoiceID_PK = c.SalesInvoiceID_FK
inner join POS_OrderPayment pop  on pop.InvoiceId = sim.SalesInvoiceID_PK
inner join ERP_FMS_SalesInvoice_Types sit on sit.SalesInvoiceTypeID_PK = pop.DiningType

where sim.SalesInvoiceCode like '%pos%'
and cast(sim.CreatedDate as date) = '2020-01-13'   
and sim.TransactionID_FK > 0 and (sim.closed = 0 and sim.IsCancel is NULL)
and pop.FK_POS_LocationId = '1' 
group by 
case 
when a.ID = 1935 then isnull(c.[Description],a.Item) else a.Item 
end 
)
t2
pivot(
sum(Sale)
for Item in ([Barbosa Cake],[Coffee],[Delivery Charges],[Sitting Charges]
)
)
AS pivot_table2

order by SalesInvoiceCode

Thursday, 9 February 2017

Alterative for javascript interval



Hello folks. If you face a scenario you where you cannot use JavaScript interval or facing some problem because of interval then following alternative can be considered.

The below example makes use of date for making interval.

  • Here we create a function waitAndExecute.  
  • A time duration in milliseconds is provided as parameter to this function. 
  • A variable start is set as current time of the day
  • Another variable end is set as start + input duration
  • Now while loop executes till the end is equal to start
  • Just to check the functionality current daytime is logged in console after the loop
  • The same function is called again after the loop to make it recursive
Invoking function with 3 seconds 
(3000 milliseconds):

waitAndExecute(3000);