Hi there,
I'm having trouble with views_or arguments generating SQL errors when using the "share arguments" option in "next alternative". When I look at the generated SQL, there is just a blank space next to the WHERE clause. Here is my arguments setup:
Date: Date (node) Content: Pricing Date (field_launchdate)
Views Or: Begin alternatives
Content: Lead (self
Views Or: Next alternative
Content: Lead
Views Or: End alternatives
When given the arguments 2009/ANZ , here is the SQL generated:
SELECT node.nid AS nid,
node_data_field_launchdate.field_launchdate_value AS node_data_field_launchdate_field_launchdate_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_issuer.field_issuer_value AS node_data_field_issuer_field_issuer_value,
node_data_field_amount_audequiv.field_amount_audequiv_value AS node_data_field_amount_audequiv_field_amount_audequiv_value,
node_data_field_self_lead_value_0.field_self_lead_value AS node_data_field_self_lead_value_0_field_self_lead_value
FROM node node
LEFT JOIN content_type_deal node_data_field_launchdate ON node.vid = node_data_field_launchdate.vid
INNER JOIN content_field_facility node_data_field_facility ON node.vid = node_data_field_facility.vid
LEFT JOIN content_field_amount_audequiv node_data_field_amount_audequiv ON node.vid = node_data_field_amount_audequiv.vid
LEFT JOIN content_field_self_lead node_data_field_self_lead_value_0 ON node.vid = node_data_field_self_lead_value_0.vid AND node_data_field_self_lead_value_0.field_self_lead_value = 'ANZ'
LEFT JOIN content_field_issuer node_data_field_issuer ON node.vid = node_data_field_issuer.vid
WHERE
ORDER BY node_data_field_launchdate_field_launchdate_value DESC
If I uncheck the "share arguments" option in "next alernative", and supply the argument 2009/ANZ/ANZ , I get the expected output:
SELECT node.nid AS nid,
node_data_field_launchdate.field_launchdate_value AS node_data_field_launchdate_field_launchdate_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_issuer.field_issuer_value AS node_data_field_issuer_field_issuer_value,
node_data_field_amount_audequiv.field_amount_audequiv_value AS node_data_field_amount_audequiv_field_amount_audequiv_value,
node_data_field_self_lead_value_0.field_self_lead_value AS node_data_field_self_lead_value_0_field_self_lead_value
FROM node node
LEFT JOIN content_type_deal node_data_field_launchdate ON node.vid = node_data_field_launchdate.vid
INNER JOIN content_field_facility node_data_field_facility ON node.vid = node_data_field_facility.vid
LEFT JOIN content_field_amount_audequiv node_data_field_amount_audequiv ON node.vid = node_data_field_amount_audequiv.vid
LEFT JOIN content_field_self_lead node_data_field_self_lead_value_0 ON node.vid = node_data_field_self_lead_value_0.vid AND node_data_field_self_lead_value_0.field_self_lead_value = 'anz'
LEFT JOIN content_field_leads node_data_field_leads_value_0 ON node.vid = node_data_field_leads_value_0.vid AND node_data_field_leads_value_0.field_leads_value = 'anz'
LEFT JOIN content_field_issuer node_data_field_issuer ON node.vid = node_data_field_issuer.vid
WHERE ((((node.type in ('deal')) AND (node.status <> 0) AND (node_data_field_facility.field_facility_value IN ('Senior domestic AMTN', 'Senior domestic AMTN (GG)', 'Senior domestic AMTN (non GG)', 'Subordinated domestic AMTN', 'Senior Kangaroo', 'Subordinated Kangaroo')) AND ((node_data_field_launchdate.field_sector_value) LIKE ('%Financial Institutions%'))) AND (((node_data_field_launchdate.field_increase_value) = ('increase')) OR (node_data_field_amount_audequiv.field_amount_audequiv_value >= 100))) AND ((node_data_field_launchdate.field_spread_value IS NOT NULL) OR (node_data_field_launchdate.field_reoffer_margin_value IS NOT NULL) OR (node_data_field_launchdate.field_reoffer_to_bond_value IS NOT NULL) OR (node_data_field_launchdate.field_flrt_margin_value IS NOT NULL) OR (node_data_field_launchdate.field_frt2_reoffer_margin_value IS NOT NULL) OR (node_data_field_launchdate.field_frt2_reoffer_to_bond_value IS NOT NULL) OR (node_data_field_launchdate.field_frt2_spread_value IS NOT NULL) OR (node_data_field_launchdate.field_flrt2_margin_value IS NOT NULL)) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_launchdate.field_launchdate_value, '%Y-%m-%dT%T'), '%Y') <= '2009' AND DATE_FORMAT(STR_TO_DATE(node_data_field_launchdate.field_launchdate_value, '%Y-%m-%dT%T'), '%Y') >= '2009')))
AND ((node_data_field_self_lead_value_0.field_self_lead_value = 'anz') OR (node_data_field_leads_value_0.field_leads_value = 'anz'))
ORDER BY node_data_field_launchdate_field_launchdate_value DESC
Am i using the "share arguments" option as I should? If I am, I guess this is is a bug.
Cheers.
Comments
Comment #1
tripper54 commentedFurther to this, I find I get the "bad" SQL when supplying the argument "2009/ANZ", and "good" SQL when supplying the argument "2009/ANZ/ANZ" whether the "share arguments" box is checked or not.
Comment #2
murzConfirm this bug.
I must use one argument with 2 values, but when I type only one argument, the SQL query works wrong.
Argument list:
Views Or: Begin alternatives
Node Hierarchy: Parent Node
Views Or: Next alternative (Share arguments turned on)
Content: Node Relations
Views Or: End alternatives
Example:
arguments: 270
arguments: 270/anytext
In second example all works good, but nodehierarchy sends only one argument and views didn't work.
Comment #3
raintonr commentedThis may well be related to #566976: SQL Syntax warning and query failure or visa-versa.
I originally posted something in the above earlier but having experimented a bit more think this bug might be the issue.
Basically:
1. Create a view with:
2. Trying to preview with only one argument gives the SQL error (missing WHERE clause).
3. Trying to preview with two arguments (even though I told it to share) works.
4. Changing the 'Next alternative' between share arguments on/off has no effect for me here.
Comment #4
skylord commentedThis is surely related to #566976: SQL Syntax warning and query failure. The reason is Views behaviour with default or invalid arguments and not its sharing...