Copy link to clipboard
Copied
Can you explain how the data gets into the browser as a JSON formatted string?
Copy link to clipboard
Copied
So, here is the info, the value had changed from 55 to 29 but, still the same issue:
structEmpUBenefits['price_tags']: 29
iDispCostPeriodID: 1
iFlexRound: 3
this is cfdump structEmpUBenefits
struct
billing_rates 29
disp_billing_rates 29.000
disp_coverage $2,000.00
disp_er_share 0.000
disp_price_tags 29.000
option_notes array [empty]
option_prevselect_notes struct
cssclass green
note
empselections.prevselectedoption.note
params array
1 empselections.withcost
2 29.000
price_tags 29
As you can see here, all disp_ elements with decimals because I used the function on it and price_tags no decimal. Another element params array also has 29.000. Below the same data from the broser json formatted.
All 0 decimals are stripped.
"option_details": {
"billing_rates": 29,
"price_tags": 29,
"disp_price_tags_not_approved": 29,
"price_tags_not_approved": 29,
"disp_er_share": 0,
"option_prevselect_notes": {
"cssclass": "green",
"params": [
"empselections.withcost",
29
],
"note": "empselections.prevselectedoption.note"
},
And, I tried to hard code 55 and 55.000 ... all the same. 0's are gone. I used it in function and displayed just straight NumberFormat(55,"_.000"), same result come back from REST call and on actual page without decimals.
Copy link to clipboard
Copied
Hmm, still not 100% clear to me how this app works
Btw, remove the #'s in this statement, as they are not needed:
<cfset structOptionDetails = cnf_u_insempnext(qUSelections = APPLICATION.cfc.format.QueryToStruct(#getCurrBenefits#, #getCurrBenefits.CurrentRow#))>
structEmpUBenefits looks all ok. It looks like some evaluation is being performed on the result, and the trailing zeros are removed in the process. Without seeing the whole application code, it will be hard to debug it further, sorry. I am still not sure how you get those JSON results btw. Where does the transformation to JSON(option_details) occur - perhaps that is the problem area?
Copy link to clipboard
Copied
How the works? I am not sure how to describe.
I tried to display a NumberFormat(55,"0.00")
This is how it looks in browser as json formatted raw data. Not bumped around in structures and arrays inside the app. This is a top structure element that is set on 5th line of the REST component.
"testnumber": 55,
"success": true
And here is the kicker, I tried the same in Chrome REST Console this is how it looks.
Can someone explain this? Why in Chrome REST Console the data looks as expected with 0's but, in browser window as a json formatted raw data 0's are truncated.
Copy link to clipboard
Copied
Can you explain how the data gets into the browser as a JSON formatted string?
Copy link to clipboard
Copied
I am an ?#!^%ot. I used JSON formatter extension. I disabled it and it and it looks ok. Now, the problem is the app itself. Somewhere in javascript it is stripping 0's.
Thanks tribule for your help. I have to shake front developers because they were pointing at me. I have never developed front end and, was totaliy lost.
Copy link to clipboard
Copied
Ok, sounds promising. We knew the CF function was ok. Show us the JavaScript and explain what is going wrong. This is why I was asking about the JSON stuff.
Copy link to clipboard
Copied
genadi_mak wrote:
I used JSON formatter extension. I disabled it and it and it looks ok.
In fact, as my experiments showed earlier,
If you add returnformat=json to the query-string, resulting in, for example,
each of the four URLs will return 55.