#fabric-chaincode #fabric-chaincode


pham.qtpham@...
 

Hi,

How can I query data in blockchain and populate the data in a poplist? 

E.g. I already have a function allowed me to bind select element with JSON array below:

function populateSelect() {

        // THE JSON ARRAY.

        var equipments = [

            {

                "equipmentNumber": "3934643b-fa03-44ea-ba94-27e7248d265e",

                "equipmentName": "e360-Ventilator",

                "equipmentCost": "1000.00"

            },  

            {   

                "equipmentNumber": "e024fc36-e41d-49f0-b40d-e4094b9aa40e",

                "equipmentName": "SPo2 Oximeter",

                "equipmentCost": "100.00"

        

            }, 

            {

                "equipmentNumber": "65b72408-41d3-4539-9efb-08edfbabaced",

                "equipmentName": "Blood Pressure Monitor",

                "equipmentCost": "300.00"

            },

        ]; 

        

        var ele = document.getElementById('orderItem');

        for (var i = 0; i < equipments.length; i++) {

            // POPULATE SELECT ELEMENT WITH JSON.

            ele.innerHTML = ele.innerHTML +

                '<option value="' + equipments[i]['equipmentNumber'] + '">' + equipments[i]['equipmentName'] + ", Unit Cost:" + equipments[i]['equipmentCost'] + '</option>';

        }   

}


Now instead of static data in JSON array, I want to use dynamic data obtained from a blockchain's query. How can I achieve this? 

Trung

Join fabric@lists.hyperledger.org to automatically receive all group messages.