anespa
February 7, 2018, 8:54am
1
Friends,
When I alert using statement
alert(JSON.stringify(this.param1));
I got result as
[{"numBuildingID":"30172010000829","numZonalID":"3017201","intWardYearID":"2013","wardname":"( 1 ) വിളക്കുളം","intDoorNO":"90","chvownerEng":"Beevi Pathumma","chvAssessEng":"ARV","ptaxold":"130","lcold":"7","surold1":"0","servold":"0","ptaxtotalold":"137","area":"64","chvFunctionalityMal":"പാര്പ്പിടാവശ്യം","chvStatusEng":"Approved","form6status":"Approved","ptaxnew":"130","lcnew":"7","sernew":"13","surnew":"0","ptaxtotalnew":"150","wardnameeng":"( 1 ) VILAKULAM","chvOfficeNameEng":"Main Office","intWardNo":"1","chvRemarksForm6":"--","isDemolished":"0","intDemolishedPeriod":"0","chvCategoryEng":"Authorised","intLBID":"172","Column1":"Varkala Muncipality","intBuildingCategory":"1","Column2":"1. Beevi Pathumma ()","chvWardNameEng":"VILAKULAM","bitIsCurrent":"1"}]
From this i need to take the value of ‘numBuildingID’,‘intBuildingCategory’ in two variables.
How it can done ?
Please advise
Thanks
MattE
February 7, 2018, 8:57am
2
Just get the variables from this.param1
let numBuildingID = this.param1.numBuildingID;
let intBuildingCategory = this.param1.intBuildingCategory;
anespa
February 7, 2018, 9:06am
3
Dear @MattE
I got that values as ‘undefined’ now.
Actually that values passed as JSON.parse (i mean object)…
please advise
MattE
February 7, 2018, 9:21am
4
Can you show to code you use for this?
Most likely you made an error there (maybe a typo)
anespa
February 7, 2018, 9:23am
5
payTax(){
alert(JSON.stringify(this.param1));
let numBuildingID = this.param1.numBuildingID;
let intBuildingCategory = this.param1.intBuildingCategory;
alert("id is: "+numBuildingID); //undefined here
}
No comments ?
MattE
February 7, 2018, 9:40am
6
What’s the output when you add this line to the top of payTax()?
console.log(this.param1);
and
console.log(this.param1.numBuildingID);
MattE
February 7, 2018, 9:42am
7
Ow wait, I know!
this.param1 is an array, not an object.
this.param1[0].numBuildingID will work.
anespa
February 7, 2018, 9:47am
8
Thanks dear you saved me …
MattE
February 7, 2018, 9:58am
9
Great!
Now mark the thread as solved, so other people see this thread has a solution.