Closed (fixed)
Project:
Views PHP
Version:
7.x-1.0-alpha1
Component:
Field Handler
Priority:
Major
Category:
Support request
Assigned:
Issue tags:
Reporter:
Created:
19 Nov 2015 at 19:05 UTC
Updated:
17 Dec 2015 at 12:14 UTC
Jump to comment: Most recent
Comments
Comment #2
silvi.addweb commentedPlease perform below steps to return value of webform components using view php:
1. Create webform content view.
2. Add 'Content:Nid' field in field section and check 'Exclude from display'.
3. Add 'Content: Webform submission' field in Relationship section.
4. Add ' Webform submissions: Sid' field in field section and check 'Exclude from display'.
5. Now add 'Globle:PHP' field and return follwing code in Value code.
6. And return follwing code in Output code.
Hope this helps you.
Thanks!
Comment #3
maryam.naji68@gmail.com commentedHi Tejal,
Thank you for your complete response. Very very interesting way of thinking.
But when I do the steps I get this:
date:please_let_us_know_how_your_day_was_with_the_client:
date:please_let_us_know_how_your_day_was_with_the_client:
date:please_let_us_know_how_your_day_was_with_the_client:
date:please_let_us_know_how_your_day_was_with_the_client:was_a_prn_given_today:if_prn_was_given_today_when_was_it_given
date:please_let_us_know_how_your_day_was_with_the_client:was_a_prn_given_today:if_prn_was_given_today_when_was_it_given
date:please_let_us_know_how_your_day_was_with_the_client:was_a_prn_given_today:if_prn_was_given_today_when_was_it_given
Which are the field keys of all components of all webforms!
It doesn't return any value and I think we need another relationship to specify the very webform node we want the submissions from. But I don't know how?!
Comment #4
silvi.addweb commentedOh yes! Apologies! One correction into the code for 6th point. Please find the updated code below:
6. And return following code in Output code.
Hope this helps.
Thanks!
Comment #5
maryam.naji68@gmail.com commentedWorked Great, Thanks sooooo much!
You open so many new doors for me and my husband :D
I added a part to output the duration for me which is:
$time1= strtotime($fields["time_in"]);
$time2= strtotime($fields["time_out"]);
$duration=($time2-$time1)/3600;
print $duration;
Thanks
Comment #6
maryam.naji68@gmail.com commentedComment #7
silvi.addweb commentedMy Pleasure! Good to hear this. Feel free to contact me in future for any Drupal related work. Always ready to help :)
Thanks
Tejal
Comment #8
maryam.naji68@gmail.com commentedHi Tejal,
Now I need to get a percentage of each submission out of all.
So as you helped me I ended up with this code to calculate time duration for each submission:
Now I need to calculate a percentage like this:
$percentage=$duration/$total * 100;
But I dont know how to calculate $total and where to put the foreach loop!
I tried so hard to find it out myself but it didn't work.
I so much appreciate your help, thanks
Comment #9
maryam.naji68@gmail.com commentedCredit provided to tejal.patel for providing my solution.
Many thanks!