Roy,<div><br></div><div>The alternative is calling the View directly. As you said you have done now.</div><div><br></div><div>As I said, I didn't read the post closely and I don't have time to now. I just wanted to help remove at least one variable for you by alerting you to the fact that testing a View via its "Preview" doesn't work all the time.</div>
<div><br></div><div>Sounds like that isn't your problem and hopefully others will jump in to help.</div><div><br></div><div>Shai<br><br><div class="gmail_quote">On Mon, Feb 15, 2010 at 12:08 PM, Roy R <span dir="ltr"><<a href="mailto:roy.redirect@gmail.com">roy.redirect@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Shai<br>
Whats the alternative?<br>
Actually I get the same results when I call the view directly.<br>
So the display Page's path is "contrib/my" ( no arguments), and<br>
typing "<a href="http://localhost/contrib/my" target="_blank">http://localhost/contrib/my</a>" gives the following:<br>
<br>
Membership # Name Uid<br>
M1019 SGOCI 1<br>
<br>
This is the result of the first query, not the result of the second.<br>
The SQL statement in the preview mode is correct as far as I can tell.<br>
So it seems this is a display issue when View arguments are supplied<br>
programatically. The view->execute() statement in my PHP code seems to<br>
be having some undesired effects, because if I replace the php code<br>
with just<br>
<br>
return 'M1019';<br>
<br>
it works.<br>
<br>
Any clues?<br>
<br>
Thanks!<br>
Roy<br>
<br>
<br>
<br>
SELECT node.nid AS nid,<br>
node_data_field_contrib_checkdate.field_contrib_checkdate_value AS<br>
node_data_field_contrib_checkdate_field_contrib_checkdate_value,<br>
node.type AS node_type,<br>
node.vid AS node_vid,<br>
node_data_field_contrib_checkdate.field_contrib_checkno_value AS<br>
node_data_field_contrib_checkdate_field_contrib_checkno_value,<br>
node_data_field_contrib_checkdate.field_contrib_voucherno_value AS<br>
node_data_field_contrib_checkdate_field_contrib_voucherno_value,<br>
node_data_field_contrib_checkdate.field_contrib_voucherdate_value<br>
AS node_data_field_contrib_checkdate_field_contrib_voucherdate_value,<br>
node_data_field_contrib_checkdate.field_contrib_accountno_value AS<br>
node_data_field_contrib_checkdate_field_contrib_accountno_value,<br>
node_data_field_membernumber.field_membernumber_value AS<br>
node_data_field_membernumber_field_membernumber_value,<br>
node.title AS node_title,<br>
node_data_field_contrib_checkdate.field_contrib_amount_value AS<br>
node_data_field_contrib_checkdate_field_contrib_amount_value,<br>
node_data_field_contrib_checkdate.field_contrib_memo_value AS<br>
node_data_field_contrib_checkdate_field_contrib_memo_value<br>
FROM node node<br>
LEFT JOIN content_type_contribution_record<br>
node_data_field_contrib_checkdate ON node.vid =<br>
node_data_field_contrib_checkdate.vid<br>
INNER JOIN users users ON node.uid = users.uid<br>
INNER JOIN node node_users ON users.uid = node_users.uid AND<br>
node_users.type = 'profile'<br>
LEFT JOIN content_field_membernumber node_data_field_membernumber ON<br>
node.vid = node_data_field_membernumber.vid<br>
WHERE ((node.type in ('contribution_record')) AND<br>
(node_data_field_membernumber.field_membernumber_value = 'M1019'))<br>
AND ((DATE_FORMAT(node_data_field_contrib_checkdate.field_contrib_checkdate_value,<br>
'%Y') <= '2009' AND<br>
DATE_FORMAT(node_data_field_contrib_checkdate.field_contrib_checkdate_value,<br>
'%Y') >= '2009'))<br>
ORDER BY node_data_field_contrib_checkdate_field_contrib_checkdate_value DESC<br>
<div><div></div><div class="h5"><br>
<br>
On Mon, Feb 15, 2010 at 11:46 AM, Shai Gluskin <<a href="mailto:shai@content2zero.com">shai@content2zero.com</a>> wrote:<br>
><br>
> Hi Roy,<br>
> Please note that I did not read your post thoroughly or truly consider your question.<br>
> I'm just writing to let you know that Views "Preview" functionality is a bit funky, it doesn't work reliably in all situations. I don't rely on Views Preview for anything. Do you really need it?<br>
> Shai<br>
><br>
> On Mon, Feb 15, 2010 at 7:14 PM, Roy R <<a href="mailto:roy.redirect@gmail.com">roy.redirect@gmail.com</a>> wrote:<br>
>><br>
>> Hello Drupal gurus,<br>
>> Newbie drupal user trying to set up a website for a non-profit org.<br>
>><br>
>> I am using Content Profile to capture a Member Account Number field in<br>
>> a CCK text field.<br>
>> I have a Content Type for Contributions which basically lists each<br>
>> contribution received, it has CCK fields for amount, check#, date, and<br>
>> Member Account Number (shared field with Content Profile)<br>
>><br>
>> I want to add a menu option called "My Contributions" that will<br>
>> display a table listing the contributions for the current user for a<br>
>> given year (exposed filter on year) i.e. I need to get the Member<br>
>> Number field, and use that to filter the Contributions nodes.<br>
>><br>
>> Reading various posts online I understood the best way to do this was<br>
>> to use Views to retrieve the Member Account Number from Content<br>
>> Profile and use that to create a default argument for another<br>
>> Contributions table View. So I have a view called<br>
>> "user_profile_select" that basically retrieves the user profile for<br>
>> the current user. (1 record only), and a second view that takes two<br>
>> parameters, a date, and a Member Number. The following code is added<br>
>> to the default argument section of the Contributions table view.<br>
>><br>
>> $view = views_get_view('user_profile_select');<br>
>> $view->execute();<br>
>> if ( count($view->result) ) {<br>
>> $ret =<br>
>> $view->result[0]->node_users_node_data_field_membernumber_field_membernumber_value;<br>
>> return $ret;<br>
>> }<br>
>> else {<br>
>> return false;<br>
>> }<br>
>><br>
>> This kind of works, I can see that the correct Member number is being<br>
>> retrieved from the first view, and the second view's SQLs WHERE clause<br>
>> shows the correct argument. But the View does not display any records<br>
>> in Preview mode. If I pass in the same parameters manually, via the<br>
>> Preview text box, it works.<br>
>><br>
>> What could be going wrong?? Thanks in advance for your help.<br>
>><br>
>> Also please let me know if there are any easier alternatives to doing<br>
>> this? I tried playing with Panels and Contexts. My thought was I<br>
>> should be able to put the first view (user_profile_select) in a Panel,<br>
>> and add the second view to the same panel and have the second view<br>
>> pull its arguments from the first view's context. But this apparently<br>
>> does not work, I cannot see any CCK fields in the context. I thought<br>
>> this kind of simple header/detail displays might be supported out of<br>
>> the box.<br>
>><br>
>> Regards<br>
>> Roy<br>
>> --<br>
>> [ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
><br>
><br>
> --<br>
> [ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</div></div>--<br>
<div><div></div><div class="h5">[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</div></div></blockquote></div><br></div>