question

mkamp avatar image
mkamp asked

convert this crystal formula field to ssrs

how do I convert the below crystal report formula field (crystal syntax)to ssrs? I've tried different ways but ultimately I am stumped. Any help would be greate Numbervar mon := Month (CurrentDate); Numbervar yr := Year (CurrentDate); Numbervar grade; if mon >6 then yr:= yr +1; grade := 12 - ({STUDENT.GRAD-YR} - yr); if grade = -1 then "PK" else if grade = 0 then "K" else if grade = -2 then "EE" else ToText(grade,0);
ssrssql-server-2012ssrs-2012crystal-report
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
@SQLShark avatar image
@SQLShark answered
I have had to make a few assumptions about your data but here goes: Sounds like this might be better calculated before hitting SSRS. If you do that here is a possible solution: DECLARE @StudentTable TABLE ( Student VARCHAR(12) , GRAD INT ); INSERT INTO @StudentTable ( Student, GRAD ) VALUES ( 'Tom', '2014' ), ( 'Jerry', '2015' ), ( 'Salvester', '2014' ), ( 'Tweety', '2013' ) DECLARE @MON INT = DATEPART(month, GETDATE()) DECLARE @YR INT = DATEPART(Year, GETDATE()) IF @MON > 6 BEGIN SET @YR += 1 END SELECT Student , grad , CASE WHEN grad - @YR = -1 THEN 'PK' WHEN grad - @YR = 0 THEN 'K' WHEN grad - @YR = -2 THEN 'EE' ELSE '0' END AS 'Grade' FROM @StudentTable
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.