nriddock
asked on
help formatting the array / data
I have the following jquery code
that generates the following array/data
the first section of code retrieves the results from the db and loops through the reults and spits each record/data set out as a separate array.
My question is ... what do i need to change in the jquery section to output the data as follows?
Thanks
$(document).ready(function () {
var BankRows = "";
var prefRows = "";
var detailBankInfo;
var BankactionInfo = {
'entityCount' : {^SFT:PAC:BankList_Count^},
'actualEntityId' : {^SFT:TRN:Bank ID^},
'actualAppId' : {^SFT:APL:Applicant ID^},
'actualType' : "{^SFT:TRN:Bankaction Sub Type^}",
'entityList' : []
};
if (BankactionInfo.entityCount == 0) { BankactionInfo.entityCount = 1; }
if ({^SFT:PAC:ProductID|TRN:ProductPackage:blankreplace(0)^} > 0)
{
{^DRP:PAC:BankList_Count|TRN:ProductPackage()
detailBankInfo = {
'id' : "{^UDT:BankCode^}",
'entityCode' : 'TRN',
'type' : "{^CFT:TRN:CreditPayroll^}",
'BankType': "{^UDT:BankSubType^}"
};
BankactionInfo.entityList.push(detailBankInfo);
/DRP:PAC:BankList_Count^}
};
BankRows = createBankListing(BankactionInfo);
$('#BankListing').append(BankRows);
});
that generates the following array/data
transInfo = {
'id' : "404828",
'entitycode' : "Credit Limit",
'type' : "01160",
'Bank': "ABC123"
};
transInfo = {
'id' : "404821",
'entitycode' : "Credit Limit",
'type' : "01163",
'Bank': "DEF322" };
transInfo = {
'id' : "404338",
'entitycode' : "Debit Limit",
'type' : "03320",
'Bank': "XYZ223"
};
transInfo = {
'id' : "45558",
'entitycode' : "Credit Limit",
'type' : "03230",
'Bank': "DEC445"
};
transInfo = {
'id' : "404831",
'entitycode' : "Credit Limit",
'type' : "08730",
'Bank': "DWC765"
};
the first section of code retrieves the results from the db and loops through the reults and spits each record/data set out as a separate array.
My question is ... what do i need to change in the jquery section to output the data as follows?
transInfo = {
'id' : "404828",
'entitycode' : "Credit Limit",
'type' : "01160",
'Bank': "ABC123"
}, {
'id' : "404821",
'entitycode' : "Credit Limit",
'type' : "01163",
'Bank': "DEF322"
}, {
'id' : "404338",
'entitycode' : "Debit Limit",
'type' : "03320",
'Bank': "XYZ223"
}, {
'id' : "45558",
'entitycode' : "Credit Limit",
'type' : "03230",
'Bank': "DEC445"
}, {
'id' : "404831",
'entitycode' : "Credit Limit",
'type' : "08730",
'Bank': "DWC765"
};
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I do not understand what code this is. What's with the ^ ??
Assuming it is some kind of template scripting language I guess
THIS: {^DRP:PAC:BankList_Count|T RN:Product Package()
is a loop
so something like
if ({^SFT:PAC:ProductID|TRN:P roductPack age:blankr eplace(0)^ } > 0)
{
{^DRP:PAC:BankList_Count|T RN:Product Package()
var x = {
'id' : "{^UDT:BankCode^}",
'entityCode' : 'TRN',
'type' : "{^CFT:TRN:CreditPayroll^} ",
'BankType': "{^UDT:BankSubType^}"
};
transactionInfo.entityList .push(x);
/DRP:PAC:TransList_Count^}
};
Assuming it is some kind of template scripting language I guess
THIS: {^DRP:PAC:BankList_Count|T
is a loop
so something like
if ({^SFT:PAC:ProductID|TRN:P
{
{^DRP:PAC:BankList_Count|T
var x = {
'id' : "{^UDT:BankCode^}",
'entityCode' : 'TRN',
'type' : "{^CFT:TRN:CreditPayroll^}
'BankType': "{^UDT:BankSubType^}"
};
transactionInfo.entityList
/DRP:PAC:TransList_Count^}
};
ASKER
the ^ symbol signifies the code directly following is a "token" - internal code the vendor uses as a form of placeholder / variable., etc.
Ill give it a try. Thanks for all your help!
Ill give it a try. Thanks for all your help!
ASKER
its yielding the same results
its still writing
its still writing
detailTransInfo = {
'id' : "404828",
'entitycode' : "Credit Limit",
'type' : "01160",
'Bank': "ABC123"
};
detailTransInfo = {
'id' : "404821",
'entitycode' : "Credit Limit",
'type' : "01163",
'Bank': "DEF322" };
i need it to merge or combine the multiple "detailTransInfo" sections into one big "detailTransInfo"detailTransInfo = {
'id' : "404828",
'entitycode' : "Credit Limit",
'type' : "01160",
'Bank': "ABC123"
}; {
'id' : "404821",
'entitycode' : "Credit Limit",
'type' : "01163",
'Bank': "DEF322" };
I am sorry. Since I do not know the nature of the code you post, I cannot help you.
Please let us know what framework you are using
Please let us know what framework you are using
ASKER
i figured out a different method
Also you likely want
Transinfo = [
{
},
{
}
];