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

Additional line in date-global

Quote Reply
Additional line in date-global
Hi to all,

i am using this global to view a SUM of data-records with a special value in colun "Ausgabe":
Code:
sub {
my $cond = new GT::SQL::Condition;
my($ausgabe)=@_;
$cond->bool('AND');
$cond->add('Ausgabe','=',$ausgabe);
$cond->add('MagArt','=','gumag');
my ($total) = $DB->table('Links')->select(['SUM(Wert)'],$cond)->fetchrow_array;
local $_ = int $total;
my($grouping,$thousands_sep);
$grouping=3;
$thousands_sep='.';
1 while
s/(\d)(\d{$grouping}($|\Q$thousands_sep\E))/$1$thousands_sep$2/;
return "$_";
}

The using is:
1. I define the "Ausgabe" from the actual date and
2. put this Ausgabe (format: mm-yyyy) into global like this:

<%set Ausgabe = GT::Date::date_transform($date, '%dd%.%mm%.%yyyy%', '%mm%-%yyyy%')%>
<%gutscheine_wert($Ausgabe)%>

Now what i need is this:
When the actual "Ausgabe" is not in db (e.g. 02-2005), then the global search for the last available date, in this case: 01-2005.
Perhaps: IF $total = 0 ...... etc ....... ???

How can i do that?

Thanks in advance!

Coyu
Subject Author Views Date
Thread Additional line in date-global Coyu 1160 Feb 3, 2005, 8:02 PM
Post Re: [Coyu] Additional line in date-global
afinlr 1097 Feb 4, 2005, 5:34 AM