Bruce Gust
asked on
How would I break down this array?
Here's my array:
I have to break this down so I can see how many screenings have occurred.
How?
Thanks!
Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58935585e1382370923e0c32
)
[first_name] => Johnathan
[last_name] => Doe
[gender] => Male
[dob] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 400827600000
)
[email] => m.cannon@appliedhealth.net
[employer] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
[name] => Bartoletti and Sons
[account] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1465448400000
)
)
[active] => 1
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
)
[contact] => Array
(
[name] => Tripp
[email] => tdearman@appliedhealth.net
[phone] => 901-485-7887
)
[logo] => https://s3.us-east-2.amazonaws.com/bmetrix-site/employer-logo-undefined-aha_logo.png
)
[mobile_phone] => 901-485-7887
[other_phone] =>
[address] => Array
(
[street1] =>
[street2] =>
[city] =>
[state] =>
[zip] => 37174
)
[active] => 1
[_age] => 34
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[1] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486050693000
)
)
[middle_initial] => E
[ssn_last_4] =>
[employee_id] => 123456
[physician] => Array
(
[name] =>
[city] =>
)
[responses] => Array
(
[0] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58acbafeaed3400d8b2976a2
)
[screening] => MongoDB\BSON\ObjectID Object
(
[oid] => 5892176de138236b7f00bcd2
)
[responses] => Array
(
[bmi] => 12
[weight] =>
[height_feet] =>
[height_inches] =>
[waist_circumference] =>
[blood_pressure_sys] =>
[blood_pressure_dia] =>
[pulse] =>
[is_diabetic] =>
[is_fasting] =>
[blood_glucose] =>
[total_cholesterol] =>
[hdl_cholesterol] =>
[hdl_ratio] =>
[ldl_cholesterol] =>
[ldl_ratio] =>
[non_hdl_cholesterol] =>
[triglycerides] =>
)
[notes] =>
[member] => MongoDB\BSON\ObjectID Object
(
[oid] => 58935585e1382370923e0c32
)
[active] => 1
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[1] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1487715070000
)
)
[events] => Array
(
[saved] => Array
(
[user] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791791fc13ae1f0d000005
)
[date] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1487715070000
)
)
)
[_stratificationValues] => Array
(
[0] => Array
(
[key] => bmi
[color] => warning
[value] => Underweight
[index] => 0
)
)
[_stratification] => Array
(
[bmi] => Underweight
)
)
[1] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58975f0be138237da52d4c62
)
[screening] => MongoDB\BSON\ObjectID Object
(
[oid] => 589378dee138237201298c22
)
[responses] => Array
(
[is_diabetic] =>
[is_fasting] => 1
[height_feet] => 6
[height_inches] => 2
[weight] => 210
[bmi] => 26.96
[total_cholesterol] => 174
[hdl_cholesterol] => 50
[ldl_cholesterol] => 86
[non_hdl_cholesterol] => 124
[triglycerides] => 185
[blood_glucose] => 85
[ldl_ratio] => 1.7
)
[notes] =>
[member] => MongoDB\BSON\ObjectID Object
(
[oid] => 58935585e1382370923e0c32
)
[active] => 1
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[1] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486315275000
)
)
[events] => Array
(
[saved] => Array
(
[user] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791791fc13ae1f0d000005
)
[date] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486403508000
)
)
)
[_stratificationValues] => Array
(
[0] => Array
(
[key] => bmi
[color] => warning
[value] => Overweight
[index] => 0
)
[1] => Array
(
[key] => triglycerides
[color] => warning-light
[value] => Borderline-High
[index] => 1
)
[2] => Array
(
[key] => ldl_cholesterol
[color] => success
[value] => Optimal
[index] => 2
)
[3] => Array
(
[key] => non_hdl_cholesterol
[color] => success
[value] => Normal
[index] => 3
)
[4] => Array
(
[key] => total_cholesterol
[color] => success
[value] => Desirable
[index] => 4
)
[5] => Array
(
[key] => blood_glucose
[color] => success
[value] => Normal
[index] => 5
)
[6] => Array
(
[key] => hdl_cholesterol
[color] => warning-light
[value] => Better
[index] => 9
)
)
[_stratification] => Array
(
[bmi] => Overweight
[triglycerides] => Borderline-High
[ldl_cholesterol] => Optimal
[non_hdl_cholesterol] => Normal
[total_cholesterol] => Desirable
[blood_glucose] => Normal
[hdl_cholesterol] => Better
)
)
[2] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58975fcee1382304b72f0ac2
)
[screening] => MongoDB\BSON\ObjectID Object
(
[oid] => 589378dee138237201298c22
)
[responses] => Array
(
[height_feet] => 6
[height_inches] => 1
[weight] => 178
[bmi] => 23.48
[blood_pressure_sys] =>
[blood_pressure_dia] =>
[pulse] =>
[blood_glucose] =>
[total_cholesterol] =>
[hdl_cholesterol] =>
[hdl_ratio] =>
[ldl_cholesterol] =>
[ldl_ratio] =>
[non_hdl_cholesterol] =>
[triglycerides] =>
)
[notes] =>
[member] => MongoDB\BSON\ObjectID Object
(
[oid] => 58935585e1382370923e0c32
)
[active] => 1
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[1] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486315470000
)
)
[events] => Array
(
[saved] => Array
(
[user] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791791fc13ae1f0d000005
)
[date] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486315649000
)
)
)
[_stratificationValues] => Array
(
[0] => Array
(
[key] => bmi
[color] => success
[value] => Normal
[index] => 0
)
)
[_stratification] => Array
(
[bmi] => Normal
)
)
[3] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58975f1ee138237cde372223
)
[screening] => MongoDB\BSON\ObjectID Object
(
[oid] => 589378dee138237201298c22
)
[responses] => Array
(
[bmi] =>
[weight] =>
[height_feet] =>
[height_inches] =>
[blood_pressure_sys] =>
[blood_pressure_dia] =>
[pulse] =>
[total_cholesterol] =>
[hdl_cholesterol] =>
[hdl_ratio] =>
[ldl_cholesterol] =>
[ldl_ratio] =>
[non_hdl_cholesterol] =>
[triglycerides] =>
[blood_glucose] =>
)
[notes] =>
[member] => MongoDB\BSON\ObjectID Object
(
[oid] => 58935585e1382370923e0c32
)
[active] => 1
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[1] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486315294000
)
)
[events] => Array
(
[saved] => Array
(
[user] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791791fc13ae1f0d000005
)
[date] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486315294000
)
)
)
)
[4] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 58937c98e138237208220bc2
)
[screening] => MongoDB\BSON\ObjectID Object
(
[oid] => 5893624ee1382370f6481a52
)
[responses] => Array
(
[bmi] => 23.67
[weight] => 165
[height_feet] => 5
[height_inches] => 10
[percent_body_fat] =>
[waist_circumference] =>
[hip_circumference] =>
[waist-hip_ratio] =>
[blood_pressure_sys] =>
[blood_pressure_dia] =>
[pulse] =>
[mean_arterial_pressure] =>
[total_cholesterol] =>
[hdl_cholesterol] =>
[hdl_ratio] =>
[ldl_cholesterol] =>
[ldl_ratio] =>
[non_hdl_cholesterol] =>
[vldl_cholesterol] =>
[triglycerides] =>
[blood_glucose] =>
)
[notes] => test12334
[member] => MongoDB\BSON\ObjectID Object
(
[oid] => 58935585e1382370923e0c32
)
[active] => 1
[_scope] => Array
(
[0] => MongoDB\BSON\ObjectID Object
(
[oid] => 587917affc13ae5e93000005
)
[1] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791805fc13ae22b0000035
)
)
[dates] => Array
(
[created] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486060696000
)
)
[events] => Array
(
[saved] => Array
(
[user] => MongoDB\BSON\ObjectID Object
(
[oid] => 58791791fc13ae1f0d000005
)
[date] => MongoDB\BSON\UTCDateTime Object
(
[milliseconds] => 1486067383000
)
)
)
[_stratificationValues] => Array
(
[0] => Array
(
[key] => bmi
[color] => success
[value] => Normal
[index] => 0
)
)
[_stratification] => Array
(
[bmi] => Normal
)
)
)
)
I have to break this down so I can see how many screenings have occurred.
How?
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was able to figure it out!
The app that I'm using utilizes the "Twig" dynamic as part of the Laravel framework.
When I do {{dump(data)}}, I get the array that you see above. Once I incorporated some of the dot syntax that you could see in other parts of the page, I was able to sniff my way around and was able to get what I needed.
To determine whether or not I had more than one "row," in terms of screenings, I did this:
{{ dump(data.responses[1].scr
If I've got an index that's greater than 0, then I've got more than one set of values in the array that I'm looking at.
And then, I used this to break things up in view-able data:
{% for d in data.responses %}
<option>{{ d._id }} </option>
{% endfor %}
...and that got it done!
Thanks for your input!