SSRS 2005 Display Fields!AMT_TOTAL WHERE Fields!DATE_ADD BETWEEN #ReportVariable1 and #ReportVariable2 - reportingservices-2005

In SSRS 2005 I am trying to display the AMT_TOTAL where DATE_ADD is BETWEEN #ReportVariable1 and #ReportVariable2.
Could someone please help me with the correct syntax of the expression?
I am assuming it is something to the affect of
=Fields!AMT_TOTAL IF DATE_ADD >= #StartDate AND DATE_ADD <= #EndDate

=IIF(Fields!DATE_ADD.Value >= Parameters!MayStartDate12.Value AND Fields!DATE_ADD.Value <= Parameters!MayEndDate12.Value, Fields!AMT_ORD_TOTAL.Value, 0)
is working!

Related

DolphinDB Calculate the time difference between TIMESTAMP and DATETIME?

I tried the script in DolphinDB:
t =table(
array(DATETIME, 0) as MDTime,
array(TIMESTAMP, 0) as ReceivedTime
)
share t as testShareTable;
select * from testShareTable;
select avg(ReceivedTime - MDTime) as DelayTime from testShareTable;
The table is
But the output is not as expected
Any suggestions to modify the code? Btw, I'd like to add 8 hours to ReceivedTime. How can I obtain the result?
Modified the last line of code:
select avg(temporalAdd(ReceivedTime,8H) - timestamp(MDTime)) as DelayTime from testShareTable;

using IF statements in Visual Studio 2010

I'm very new to Visual Studio, and am using 2010 right now.
I'm getting stuck in the Expression Builder when setting variables.
I have 2 vars #[User::Month] and #[User::Year]
#[User::Month] = MONTH( GETDATE() ) - 1
Now I need to set year to be current year unless #Month = 1, then be current year - 1. I just can't figure out how to use if statements in the Expression Builder.
I've tried:
If #[User::Month] == 1 Then
YEAR( GETDATE() ) - 1
Else
YEAR( GETDATE() )
EndIf
I've tried searching, but can't find any assistance on using the Expression Builder.
You are not currently setting anything in your if statement. The correct if statement would be:
If #[User::Month] == 1 Then
#[User::Year]=YEAR( GETDATE() ) - 1
Else
#[User::Year]=YEAR( GETDATE() )
EndIf
I ended up finding the answer here
#[User::Year]=(MONTH(GETDATE())==1? YEAR(GETDATE())-1 : YEAR(GETDATE() ))

How stock a numeric value (diff of 2 date)

I've to calculate the différence between two Dates : TODAY() and DATE_DEB_VAC.
With Oracle, it's kinda easy : TODAY()-DATE_DEB_VAC -> give the number of day between those 2 date.
But I've to do it with in an ETL (GENIO). I've a column to stock it like that :
NUMBER_DAY_DIFF (NUMBER 10) = TODAY()-DATE_DEB_VAC. But it's impossible to stock it cause it's 2 date.
How can i do this ? :(
You can try the val function of GENIO ETL
VAL(TODAY()-DATE_DEB_VAC)
this is equivalent to to_numbre in Oracle
NUMBER_DAY_DIFF (NUMBER 10) = DATEDIFF (TODAY; DATE_DEB_VAC)
Should give you what you need.

How does using (RecordSet).EOF on If statements work?

I have these lines of code, from vb6 trying to migrate them to vb.net.
What´s the logic behind them?
RegFileHf.CommandText = "Select dayspassed from Config"
Set UltHf = RegFileHf.Execute
If Not UltHf.EOF Then
someDate = Date - UltHf.Fields("dayspassed")
Else
someDate = Date - 180
End If
Does the If statement executes multiple time until end of file?
Does the else part comes in only when there´s no rows on my SQL query?
(Can you guys recommend good books to learn VB.NET so I can stop making newbie questions?)
Thanks in advance.
EOF condition mean that you get in the end of data .. that mean no row return
So, if there's (a) rows it will fire -> someDate = Date - UltHf.Fields("dayspassed")
If there's no row it fire -> someDate = Date - 180
Something like that ..
In VB.NET
Dim query = "Select dayspassed from Config"
Dim dc = New OleDbCommand(query, connection)
Dim rows As OleDb.OleDbDataReader
rows = dc.ExecuteReader
If rows.HasRows Then
'...... someDate = Date - rows.item("dayspassed")
else
'...... someDate = Date - 180
End If
Book --> try Google to find

compare the dates with linq

I have this code:
i.SpesaVitto = db.TDP_NotaSpeseSezB.Where(p => p.GiornoFine == null &&
((DateTime)p.Giorno).Date == ((DateTime)i.Data).Date &&
p.MissioneID == missioneID).Sum(p => p.Costo);
If i launch it i obtain this error:
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
how can i compare the datetimes field without the hours part
thanks
Well this is certainly not the most efficient way to do it, but you can try something like:
i.SpesaVitto = db.TDP_NotaSpeseSezB.Where(p => p.GiornoFine == null &&
(new DateTime((p.Giorno as DateTime).Year, (p.Giorno as DateTime).Month, (p.Giorno as DateTime).Day) == (new DateTime((i.Data as DateTime).Year, (i.Data as DateTime).Month, (i.Data as DateTime).Day) &&
p.MissioneID == missioneID).Sum(p => p.Costo);
Depending on the requirements I would probably implement something cleaner and faster but it would depend on how the dates are stored in your database.
Check out this question it looks like the syntax error may be in your SQL, not in your LINQ. The asker in that question had written:
SQL ------
Select
EmployeeNameColumn
From
EmployeeTable
WHERE StartDateColumn.Date <= GETDATE() //Today
SQL ------
When they should have written:
SQL ------
Select
EmployeeNameColumn
From
EmployeeTable
WHERE StartDateColumn <= GETDATE() //Today
SQL -
solution for your problem will be the "SqlFunctions class and DateDiff" http://msdn.microsoft.com/en-us/library/system.data.objects.sqlclient.sqlfunctions.aspx

Resources