SSRS Expression Conversion to UTC - sql-server

I have tried my best to convert one textbox to UTC using the SSRS expression. It is not converting it. Is there any settings to configure before this code can work ? i used these two code below. Nothing works!
=TimezoneInfo.ConvertTimetoUtc(CDate(Fields!Starttime.Value))
=DateTime.SpecifyKind(Fields!Starttime.Value, DateTimeKind.UTC)

Use the expression below
=Fields!Starttime.Value.ToUniversalTime()
Design & Result with sample data

Related

DecimalSeparator in PrimeNG Spinner does not work

When I set decimal separator to anything (eg comma), it reverts back to period on blur. Even clicking increment and decrement, it does not use comma but period.
Moreover, if I am using decimalSeparator and step properties together, in which format should I set the step?
Here's what my html looks like...
<p-spinner [(ngModel)]='selected' [decimalSeparator]="','" [step]="'0,1'"></p-spinner>
I have tried the values without quote & variable as well but no luck.
Thanks in advance.
PrimeNG 7 doesn't support decimalSeparator and thousandSeparator. You can make an upgrade to PrimeNG 8.0.2, then you can use the parameters and formatInput too.

Regular Expression date time using MVC Data Annotations

I'm mixing MVC Data Annotations and AngularJs validations ng-pattern.
What I've done so far is this thing:
[RegularExpression("/^[0-9]{4}-[0-9]{2}-[0-9]{2} 20|21|22|23|([0-1][0-9]):[0-5][0-9]:[0-5][0-9]$/", ErrorMessage = "Date format: yyyy-mm-dd hh:mm:ss")]
As you can see, I try to format date: yyyy-mm-dd hh:mm:ss.
I want to make it 24 hours time.
My problem is that form is getting valid when I type:
2015-21 , 2015-22 // 2015-20 is not valid, cannot understand why
2015-12-20 21 // I want user to enter minutes and seconds, because it also has datetimepicker, which is more useful and it sets format as I want
So, why my regular expression is not working as I expect?
Your regex does not work as expected because you did not use a ^ anchor (although I guess this expression is anchored, but still it is better to play it safe) and you did not enclose the alternatives into a group, and thus 21, 22, 23 are valid values.
Here is a fixed expression:
^[0-9]{4}-[0-9]{2}-[0-9]{2} (?:20|21|22|23|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$
^^^ ^^
See demo
change your regex instead to be like this
^[0-9]{4}-[0-9]{2}-[0-9]{2} ((20|21|22|23)|([0-1][0-9])):[0-5][0-9]:[0-5][0-9]$
check this Demo
I only changed 20|21|22|23|([0-1][0-9]) in your regex to ((20|21|22|23)|([0-1][0-9]))

CakePHP: CakeTime i18nFormat for date and time

I'm using the CakeTime class for my localization of dates & times.
For dates it works like I want it to:
$timestring = $this->Time->format('Y-m-d H:i:s', time());
echo 'DateTime: '.$this->Time->i18nFormat($timestring);
// Result => DateTime: 11/08/2013
I want it to also display the time.
For example in the US they use AM/PM and in other places they use the 24 hour notation.
I've looked but can't seem to find a way to do this.
Any idea's?
Edit*
To be clear, the localization works perfectly for the dates(have the LC_TIME files), but the i18nFormat function only returns the date, and from what i saw, passing a format will use that format, not the localized one, example MM/DD/YYYY vs DD.MM.YYYY in a different locale
*Edit2:
The solution vicocamacho gave in the comments is the correct one
So to get the Date + Time in the localized form:
$this->Time->i18nFormat(time(), '%x %X') does the trick!
You can use the TimeHelper::i18nFormat method. You also can check this repo to find common date/time translations https://github.com/cakephp/localized be sure to store them in the APP/locale/<locale>/LC_TIMEdirectory

Programmatically Position Image on RDLC using Database Values

I have an image that I'd like to programmatically position on an RDLC based on the X and Y values from the database. I originally thought I could just apply an expression to the Left and Top properties of the Location property, however it doesn't seem like there's an option to do that.
Is there anything I can do?
EDIT:
Fortunately the padding property allows expressions, however it seems I have another issue on my hands.
Here's my code for the "Left" property within the "Padding" property group.
=((Sum(Fields!intDessinX.Value, "dsRapport_uspReportCommandeInhumation") * 2.54) / 96) & "cm"
Essentially I'm converting the intDessinX value from the database from pixel to cm using the formula "cm = (pixel * 2.54) / 96" and finally appending "cm" to the end of the expression.
This does not work. I've done some research and can't seem to find how to take the value from a dataset and translate it into a measurement.
Does anyone know how to do this?
Thanks,
Mikael
Solved!! Since we're developing the website in French we had previously set the culture to "fr-CA" and this causes the decimal character to be replaced by a comma character.
As such, when it came time for the reporting engine to evaluate the value (with the comma), it wasn't positioning my image as it simply didn't understand that the value was in fact numeric.

SSRS - Adding "LIKE" filter criteria to report builder

I want to add a LIKE filters with wildcards in SSRS report builder. I tried this using contains clause present in filter data section of report builder. I tried both '*' and '%', but of them failed.
I tried
MyFieldName contains 2451 - this succeds
MyFieldName contains 24* - this fails
MyFieldName contains 24% - this fails
From below link I feel that this is an old problem with no solution till yet.
http://connect.microsoft.com/SQLServer/feedback/details/202792/ssrs-adding-like-filter-criteria-to-report-builder
What do you guys suggest?
Thanks
Ravi Gupta
You could use the InStr function
=IIF(InStr(Fields!MyFieldName.Value, "2451"),TRUE,FALSE)
In SSRS we can't use Like. Instead of which you can use Contains.
IIF((MyFieldName).ToString().Contains("RequiredString"),"True","False)
In the report builder in Visual studio there is a Like and it works. Use a * as wildcard in your search string
Answering my own question, Below function worked for me:
IF(FIND(MyFieldName, "24") = 1, TRUE, FALSE)
This is just a partial answer as this will work for cases like (blabla*), but its not for cases like (bla*bla, blabla*). So anyone having a better idea is most welcome.
Got idea to do this from Darren's comment above.
Thanks
Ravi Gupta
The Report Builder does not support the LIKE operator. You must use CONTAINS;
This is pretty late to the party, but I worked out a solution for parameter filters for my dataset.
Adding a filter to my dataset with
Expression:
=IIF(InStr(Fields!AccountName.Value, Parameters!paramAccountName.Value) OR Parameters!paramAccountName.Value = "*", TRUE, FALSE)
Type
Boolean
Operator
=
Value
true
The parameter are defaulted to "*" so the report looks like it grabs everything by default.
I just came across this old thread and I'm curious why you can't use the like keyword, since I've always used it.
Did you try something like this?
Where (AccountName like '%' + #paramAccountName + '%' or #paramAccountName ='')

Resources