expression to format date as Su 1 in SSDT - sql-server-data-tools

I am working in SSDT creating a report. Trying to get a row/field to display "Su 1" , "Mo 2" for the day of week + increment the number of that day in the pay period.
First half of code works. returning (Mo, Tu, We, Th, Fr etc)
= LEFT(FORMAT(Fields!TransactionDate.Value,"ddd"),2)
Issue Need to complete 2nd half to provide the increment count for the pay period.
Code: + " "+ (STR(FORMAT(Fields!TransactionDate.Value,"d"))

FIX! bottom line of code produced the result I needed.
=LEFT(FORMAT(Fields!TransactionDate.Value,"ddd"),2)
+ " "+ CStr(CInt(Format(Fields!TransactionDate.Value,"dd")))

Related

Rule runs manually but returns the error code "an unexpected error has occurred" when incoming mail arrives

Microsoft 365 V2205, build 15225.20204
The following VBA macro used to work, and it still works when run manually. A couple of years ago, I am guessing that a change from Microsoft occurred, and it now returns the error code "an unexpected error has occurred" when Outlook automatically runs it. Can someone show me a fix for the rule/VBA that will allow the rule/VBA to:
On an incoming email
Mark it as high importance
Update the subject
Set a category “Bill”
Set a reminder
Here is the:
Rules description
Apply this rule after the message arrives
With ‘Your credit card statement is ready’ or ‘Your statement is ready for credit card ending’
And on this computer only
Mark it as high importance
And run Damian.PendingPaid1
Here is the VBA:
Sub PendingPaid1(Item As Outlook.MailItem)
Item.Categories = "Bill"
Item.Subject = Item.Subject & " " & Chr(150) & " Pending " & Chr(150) & " PAID " & Chr(150) & " 220"
Item.ReminderSet = True
Item.FlagDueBy = Date + 1 & Space(1) & "8:45 AM" ' Remind 1 day from now.
Item.ReminderTime = Date + 1 & Space(1) & "8:45 AM" ' Remind 1 day from now.
Item.Save
End Sub

Conditional formatting for dates in Crystal Reports

Relatively new to Crystal Reports. I'm trying to get a date to populate normally if it is after today's date, but with a leading and following asterisk if it's prior to today's date.
What I tried:
if {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}>CurrentDate then {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}
else "* " &({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}) & " *"
When I check the formula I receive "A date-time is required here" error relating to:
"* " &({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}) & " *"
Little help for a newbie? (Also, yes, I realize "availability" is spelled incorrectly.)
I was missing was the date formatting for the else statement:
if {V_ORD_AVALIABILITY.MUST_SHIP_DATE} = DATE(0000,00,00)
then " "
else (if {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE} <= CurrentDate
then totext({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}, "* M/d/yy *")
else totext({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}, "M/dd/yy")}

Meteor Timed variable resets

I'm making a game with meteor and I want certain variables to reset at the end of everyday.. DO you know how I would go about doing that?
Like at the end of everyday the amount of turns goes back to ten.
I recommend you to use momentjs package for this.
First run.
meteor add momentjs:moment
Now you can do the follow
var day = moment().endOf('day').fromNow(),
day1 = moment().startOf('day').fromNow();
console.log("the days ends in " + day)
console.log("the days starts " + day1)
if(day === "in 0 hours"){
alert("The day is over")
Session.set("dayOver",true)
}
if(day1 === "in 24 hours ago"){
alert("The day is over")
Session.set("dayOver",true)
}
Here is the JSFiddle
NOTE: There should be another way, also this take the client time, never trust on the client time, if you want to take the safe time from the server try the mizzao/meteor-timesync package
Try it
meteor add mizzao:time sync
and you can do things like.
var serverTime = TimeSync.serverTime().
serverTime.format(). //for example

Access 2007 - Referring to sub-report value from sub-sub-report

I have a report that has several sub-reports as well as a sub-report to one of the sub-reports.
The one that concerns me:
rptProgressReport ->rptEmployee (sub of rptProgressReport) -> rptSubEmployeeProject (sub of rptEmployee)
So far everything is generating as needed. Employees list in order, and the sub-report pulls out various project details. Except I need to add together time spent from one table.
tblProject (main table) -> tblProjectHistory (related table to tblProject via projectID->fldProjectID).
tblProjectHistory has the following fields.
[historyID],[fldProjectID], [History Information], [History Date], [Time Spent], [Employee].
I need to do a sum of all [Time Spent] for projects that equal what is being displayed and as long as the employee matches and the date is within the specified date range.
Specified date range is via the launching Form (frmReportGeneration) with fields txtStartDate and txtEnd Date.
Sub-report rptSubEmployeeProject has a text box (txtTimeSpent) that I have the following for a control source.
=Sum(DLookUp("[Time Spent]","tblProjectHistory","[Employee]='" & [Reports]![rptEmployee].[txtTempEmployee] & "' AND [History Date] > " & [Forms]![frmReportGeneration].[txtStartDate] & " AND " & [History Date]<" & [Forms]![frmReportGeneration].[txtEndDate] & "))
the rptEmployee field of txtTempEmployee correctly displays the current employee to match in that sub-report.
The problem is I get prompted for each value part of the above code - txtTempEmployee and txtStartDate/txtEndDate, even if I change the report value to be [Reports]![rptProgressReport]![rptEmployee].[txtTempEmployee]
Any idea how to correctly pull variables from the parent report or the first sub-report?
Thank you.
+++++ Update +++++
Okay update/close on this. I ended up needing to do something similar to what was suggested in the accepted answer. I could not get the idea posted to work - but i was able to set tempvars in vba and used those throughout the report/sub-report(s).
it is not recommended to refer to other objects via this construct "Forms!...." (or "Reports!...")
i made some bad experience with it. i suggest to put the values into a variable and make a
Get-Funktion:
in a Module you define:
Publicg dtStart As Date
Public gdtEnd As Date
in the form you assign the start and end date in the button where you fire the report
gdtStart = Me!txtStartDate
gdtEnd = Me!txtEndDate
now the Get-Function:
Public Function Get_Date_Start () As Date
Get_Date_Start = gdtStart
End Function
Public Function Get_Date_End () As Date
Get_Date_End = gdtEnd
End Function
in the Query you can use it now like this:
... AND [History Date] > " & Get_Date_Start() & " AND " & [History Date] <" & Get_Date_End()
BTW: don't use spaces in any object-name: instead of [History Date] name it History_Date, you can avoid Brackets in Code :-)

Formula with datetime in Crystal Reports 2011 VS 2010, does not filter properly

I have a formula in my report that I use to filter data and time periods, this formula I am using a static parameter of type DateTime, with the option enabled Allow range values​​, only that the rest of this standard.
I created a new formula in the Formula Fields to the following expression:
WhilePrintingRecords;
DateTimeVar date1;
DateTimeVar date2;
date1:=Minimum ({?DateRange});
date2:=Maximum ({?DateRange});
"Periodo de filtro: " + ToText(date1) + " até " + ToText(date2)
I'm using CrystalReportViewer in asp.net how to view my report when I run my report stating the date and start time and ending date and time the report that I returned all the data in my table.
My database is receiving a field datetime2(0) in YYYYMMDD HH:MM:SS, the CrystalReportViewer component inform the date and time in the format DD:MM:YYYY HH:MM:SS may have some relationship between the formats for dates with the filter does not work?
Your record-selection formula should be:
{table.date} IN {?date range}
If you want to display the date-range parameter:
//{#date-range display}; it may need to be adjusted to handle the 'no lower bound' and 'no upper bound' settings
ToText( Minimum({?date range}), "dd/mm/yyyy" ) + " - " + ToText( Maximum({?date range}), "dd/mm/yyyy" )

Resources