Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Get Latest Review on Detailed Page

(Page 2 of 2)
> >
Quote Reply
Re: [sangiro] Get Latest Review on Detailed Page In reply to
Hi,

Quote:
Is there a reason why the <%Num%> tag is not working on the detailed page?

Because Num isn't an actual column, but rather the sum of Review_WasHelpful + Review_WasNotHelpful.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [SSmeredith] Get Latest Review on Detailed Page In reply to
Hi,

Quote:
I do want to point out that the review will appear before you have validated it.

You should add:

Review_Validated => 'Yes'

to the select claue so you only get validated links.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Get Latest Review on Detailed Page In reply to
Ok - I can appreciate that...

I'm trying to do a quick global to calculate this value for my non-review pages. Here's what I have so far but it returns "0". What do I have wrong?

Code:
sub {
my $id = shift;
my ($was,$wasnot)=$DB->table('Reviews')->select({ReviewID=>$id},
['Review_WasHelpful','Review_WasNotHelpful'])->fetchrow_array;
my $total = $was+$wasnot;
return $total;
}

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Get Latest Review on Detailed Page In reply to
Hi Sangiro

you could also build a sum of the fields within your SQL command. Try something like this:

SELECT ... Review_WasHelpful + Review_WasNotHelpful as Result FROM table ...

I would test the SQL command with a DB server and look at the output - once you know how the output is, you will be able to determine which variable (if you have more than one column) you can use as output of your global. In the sample above, you would see a field "Result" that is the sum of your two other fields.

Hope this helps,
Oliver
Quote Reply
Re: [sangiro] Get Latest Review on Detailed Page In reply to
If you have all the properties of the Review table available as tags couldn't you just use something like
<%set Num=$Review_WasHelpful + $Review_WasNotHelpful%>
(you may need to build this out of a couple of set statements)
Quote Reply
Re: [afinlr] Get Latest Review on Detailed Page In reply to
Laura,

I tried this initially with no luck. I just tried again and the tag returns nothing (not even 0, but not an error either.) The values for both Was- and WasNotHelpul are definitely available. Not sure why they don't want to add up... Crazy

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Get Latest Review on Detailed Page In reply to
As I thought, you do have to build it up from a couple of set statements. Try this
<%set Num = $Review_WasHelpful%>
<%set Num += $Review_WasNotHelpful%>
Quote Reply
Re: [afinlr] Get Latest Review on Detailed Page In reply to
Works like a charm. Thank you. Smile

Safe swoops
Sangiro
> >