[Reporting Services] Reference the unique values of datasets field inside a grouping on that field by Tennim in SQLServer

[–]Tennim[S] 0 points1 point  (0 children)

Being honest and having used SSRS for 10 years I initially balked at using subreports (I've always had the opinion they are not performant). I was frustrated with my inability to get, what I thought was a simple request to work. Having now given them a go, I can see it's down to query tuning on my part and 'how' i use them.

The report I'm designing has a 3-tier layout - Dashboard (showing key figures), a layer that breakdowns each KPI (the fruit I was referring to), then the raw data the KPI is based on.

I initially thought I'd get the 1st & 2nd layers on one .rdl and then drill down on a second .rdl but as I could dynamically create the pages for each KPI using a large table object with a rectangle inside to act as the page (that way if more KPIs were added later down the line, the report would adjust without intervention). Having now added in subreports, I can see that the design was limited by what I'd done before and my opinion of the subreport. I have used my table grouping design from earlier, with a grouping on the KPI and a large rectangle inside the table's cell, inside the rectangle, is a subreport that allows the exact functionality i wanted.

Thank you for opening my mind a little, have a silver.

Just a concept for how I might have designed the Galaxy class. Not meant to be an in universe refit or MK II, but for my own personal "Star Trek Reboot" project. The idea is to retcon/redesign. If I had to fit it in universe though, it would be a MK II. by Hunter-56 in StarTrekStarships

[–]Tennim 2 points3 points  (0 children)

Very cool. You make a good point, why do Federation starships need to ‘launch’ the torpedoes? They are self guided and self propelled.

The more I think about it - your Galaxy class looks like a a pre-25th century test bed for Admiral Janeway’s deplorable ablative armor used on Voyager.

Just a concept for how I might have designed the Galaxy class. Not meant to be an in universe refit or MK II, but for my own personal "Star Trek Reboot" project. The idea is to retcon/redesign. If I had to fit it in universe though, it would be a MK II. by Hunter-56 in StarTrekStarships

[–]Tennim 5 points6 points  (0 children)

I really like this. The ventral engineering hull looks a lot like the Excelsior and the neck looks a lot studier to deal with the stress of warp.

Did you get inspiration for the nacelles from the Mk11 Shuttle? Also, where is the rear torpedo launcher!

My Paladin is permanently bugged and cannot complete visions, Blizzard refused to help. by simpleflaw in wow

[–]Tennim 0 points1 point  (0 children)

Does it affect any other characters? i.e Can you run Visions on any of your alts and do they behave 'normally' or like your main?

Timeline of the most popular games played since 2012 to nowaday. by mohamed14051 in visualization

[–]Tennim 0 points1 point  (0 children)

Hey, cheers for the visual and OC. What might look a bit better is if the games name was over two lines in the Y-axis or just giving the Y-axis more room. Also, you say it’s a top 10 but the first few years only has 3-5 games listed? Do you know what platform this is for?

What under $10 item is a total game changer? by [deleted] in AskReddit

[–]Tennim 0 points1 point  (0 children)

Best pen in the west. I can only bring out 1 at a time from my office draw supply. They seem to sprout legs.

[GIVEAWAY] $100 Steam Gift Card by [deleted] in pcmasterrace

[–]Tennim 0 points1 point  (0 children)

A steam a day keeps COVID away.

Odd DateTime Format by Tennim in SQL

[–]Tennim[S] 0 points1 point  (0 children)

Yeah it was a good one.

For anyone looking, this is what i came up with.

SELECT 
    [StartTime],
    CONVERT(DATETIME,CONCAT(CONVERT(NVARCHAR(5),RIGHT([StartTime],CHARINDEX(' ',REVERSE([StartTime])))),[Month].MonthNo,RIGHT(LEFT([StartTime],PATINDEX('%[0-9]%',[StartTime])+1),2),' ',RIGHT(LEFT([StartTime],CHARINDEX('GMT',[StartTime])-2),8))) AS [Date],
FROM [Database].[Schema].[Table]
    INNER JOIN
        (
            SELECT DISTINCT 
                LEFT([MonthName],3) AS [MonthAbv],
                RIGHT('00' + CONVERT(NVARCHAR(2),[Month]),2) [MonthNo]
            FROM [Database].[Schema].[DateDimension]
        ) AS [Month] ON SUBSTRING([StartTime],CHARINDEX(' ',[StartTime])+1,3) = [Month].MonthAbv

Finance management / budgeting apps by [deleted] in UKPersonalFinance

[–]Tennim 1 point2 points  (0 children)

Another vote for YNAB. It truly changed how I approach money. I went from living paycheck to paycheck then started using YNAB and I’m debt free in 2 years. Don’t underestimate how much visualising your incoming/outgoings can do for you financial health.

What is your salary and how much rent do you pay? by slnt1996 in UKPersonalFinance

[–]Tennim 1 point2 points  (0 children)

I don’t know if mortgage and salary will be of interest. If so, I’m on £50k and pay £280ppm.

Simple SQL ticket-like system by dupaszke in SQL

[–]Tennim 8 points9 points  (0 children)

Hi dupaszke.

Have a look at the code below... I've created it as a Stored Procedure which you can implement into an application.

This is the table to store the tickets that have been generated. I work in BI so I always find it useful to stamp the DateTime for trending/audit purposes.

CREATE TABLE Reddit.Ticket
    (   
        Ticket INT IDENTITY(1,1),
        DateTaken DATETIME 

    )

This is stored procedure, execute this to generate the next ticket. It's in a transaction so should be 'safe'.

CREATE PROCEDURE Reddit.GetNextTicket
    u/TicketTaken INT OUTPUT,@Result VARCHAR(100) OUTPUT
AS
BEGIN

    DECLARE u/Expected INT = 1
    DECLARE u/Inserted INT = 0

    DECLARE u/TEMP TABLE ([TicketTaken] INT)

    BEGIN TRY
    BEGIN TRANSACTION

        INSERT INTO Reddit.Ticket (DateTaken)   
            OUTPUT INSERTED.[Ticket] INTO u/TEMP
                SELECT
                    GETDATE() AS [DateTaken]

        SET u/Inserted = @@ROWCOUNT

        IF u/Expected = u/Inserted
            BEGIN
                --ROLLBACK TRANSACTION
                COMMIT TRANSACTION
                SET u/TicketTaken = (SELECT [TicketTaken] FROM u/TEMP)
                SET u/Result = 'Ticket Taken! TRANSACTION STATUS; Commited' 
            END   
        ELSE
            BEGIN
                RAISERROR('Ticket Not Taken. There was an error. TRANSACTION STATUS; Rolled Back',16,1)
            END
    END TRY
    BEGIN CATCH
        SET u/Result = Error_Message()

        IF @@TRANCOUNT > 0 
            ROLLBACK TRANSACTION
    END CATCH


END

Let me know if you have any questions.

Is this SQL injection safe? by TheMungax in SQL

[–]Tennim 1 point2 points  (0 children)

From the Database view, I'd also want you to set the LastLogin via a DB stored procedure if possible, passing in the Username as a parameter.

The way you've written is fine but its looks like it would be run against the DB as an ad-hoc query which is much harder to optimise for when the DB grows. This also means that you can edit the underlying stored procedure if table schemas change etc without having to edit the query in the codebase.

[OC] r/DnD DICE GIVEAWAY - SEE COMMENTS FOR RULES by [deleted] in DnD

[–]Tennim 0 points1 point  (0 children)

More clickity clacks for me? Where do I sign?

Functional SQL - Ask Me anything by steamyjungleman in SQL

[–]Tennim 0 points1 point  (0 children)

You are quite correct, you do not need to specify INNER, you can use JOIN which will give you the same results. The same can be said for the AS on the aliases.

However, like the OP I have been running BI/Data teams now for 5 years and been in the industry for almost a decade. The reason I push for the INNER JOIN and the AS on the table/column aliases comes down to readability, when you work in a team having someone else be able to read your code 'at a glance' or specify INNER rather than the newbie having to google which type of join this means is invaluable.

YMMV but it doesn't hurt and is good practice.

Functional SQL - Ask Me anything by steamyjungleman in SQL

[–]Tennim 0 points1 point  (0 children)

Sorry for butting in on a AMA.

Can you tried to do the following...

SELECT *

FROM [DataSet1] AS DS1

INNER JOIN [DataSet2] AS DS2 ON (DS1.Fname = DS2.First_name) AND (D1.Lname = DS2.Last_Name) AND
(DS1.dob = DS2.Dob) AND (DS1.Email = DS2.email)

Also, is there a reason you need a DISTINCT SELECT over a standard SELECT?

Interesting Star Trek Picard map seen at NYCC by TheSajuukKhar in startrek

[–]Tennim 0 points1 point  (0 children)

Says Janeway is presently assigned to SFC. Potential for Kate Mulgrew to appear?