Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Posts posted by justsomeguy

  1. Why are you using a for loop at all?  It's an array with a single value in it, you don't need to loop.  And if there's nothing in $_SESSION, then it won't loop to set the value at all.

  2. The sum would come from another query, although depending on which database you're using you can probably use subqueries to group the results from multiple queries into one result set.

  3. From the manual:

    u (PCRE_UTF8)
    This modifier turns on additional functionality of PCRE that is incompatible with Perl. Pattern and subject strings are treated as UTF-8. An invalid subject will cause the preg_* function to match nothing; an invalid pattern will trigger an error of level E_WARNING. Five and six octet UTF-8 sequences are regarded as invalid since PHP 5.3.4 (resp. PCRE 7.3 2007-08-28); formerly those have been regarded as valid UTF-8.
    • Like 1

    123aaa

    I would just combine that into one query, I'm not sure what [MSCRM].[dbo].[Filtered] is supposed to be, but apparently it's not that.

    SELECT Pipeline, SUM(FY20),  SUM(FY21), SUM(FY22), SUM(FY23), SUM(FY24)
    FROM (SELECT TOP (1000)
    
    CASE
    
    WHEN big_status = 913800000 THEN 'Active'
    
    WHEN big_status = 913800001 THEN 'Inactive'
    
    WHEN big_status >= 913800002 THEN 'Pending'
    
    WHEN big_status <= 913800006 THEN 'Pending'
    
    ELSE 'Closed'
    
    END AS Pipeline
    
    ,[big_fy20revenue_base] AS FY20
    
    ,[big_fy21revenue_base] AS FY21
    
    ,[big_fy22revenue_base] AS FY22
    
    ,[big_fy23revenue_base] AS FY23
    
    ,[big_fy24revenue_base] AS FY24
    
    FROM [MSCRM].[dbo].[Filtered]
    
    WHERE (big_unitname='Projects' or big_unitname='Products' or big_unitname='Strategy') AND big_revenue = 'External Revenue' AND statecode = 'Open') AS tmp
    GROUP BY Pipeline

     

  4. You can put that tag in the head to load that file, and the code in that file should use the DOMContentLoaded event to make sure the code runs after the page finishes loading.

    • Thanks 1
  5. All of that Javascript needs to go in a ready handler.  When the browser executes the code in the head, it has not set up the body of the document yet, so that myBtn element does not exist.  That's why you use a document ready or load handler, it waits until the document is finished loading and ready to run the rest of the code.

    Any code that interacts with any element on the page needs to be in a load handler, or at the end of the body.  Once the browser gets to the code at the end of the body it has already created everything else.  If it's in the head and trying to work with elements on the page it needs to be in a load handler.

×
×
  • Create New...