Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Qlikview - a real pleasure to work with

Qlikview - a real pleasure to work with

Scheduled Pinned Locked Moved The Weird and The Wonderful
tutorialquestion
15 Posts 14 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R realJSOP

    I created a datetime variable like so

    LET vTEST = '2018-09-05 13:27:14.5';

    Then, I tried various methods to strip the time component from the date. Here are the various techniques for doing this, along with their generated results:

    DATE(MAKEDATE(YEAR($(vTEST)), MONTH($(vTEST)), DAY($(vTEST))), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
    DATE(FLOOR($vTEST)), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
    DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05" <======== THIS is what I wanted

    A Qlikview datetime is represented by a floating point number with the date on the integer side of the decimal point, and the time on the fractional side. I honestly thought the FLOOR function would do what I want, but it left the minutes untouched, which resulted in the variable still having a time component. The only way I could get the time completely stripped is illustrated in the last example. Have I mentioned how much I hate working in Qlikview?

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #6

    John Simmons / outlaw programmer wrote:

    DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF')

    In my geeky teens I would have thought, "oh wow, this is so cool, 4 levels of parens!" and shown it to all my friends (erm, wait, what friends???) who would have gone "wow, that IS cool!" (if I had any friends.) Now in my geeky 50's I'm with you -- I look at that and think, wow, what BS is this?

    Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    OriginalGriffO R Sander RosselS 3 Replies Last reply
    0
    • M Marc Clifton

      John Simmons / outlaw programmer wrote:

      DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF')

      In my geeky teens I would have thought, "oh wow, this is so cool, 4 levels of parens!" and shown it to all my friends (erm, wait, what friends???) who would have gone "wow, that IS cool!" (if I had any friends.) Now in my geeky 50's I'm with you -- I look at that and think, wow, what BS is this?

      Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #7

      Marc Clifton wrote:

      "oh wow, this is so cool, 4 levels of parens!"

      And your geeky friends would have mocked you because there are 5 levels... :laugh:

      Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      K 1 Reply Last reply
      0
      • R realJSOP

        I created a datetime variable like so

        LET vTEST = '2018-09-05 13:27:14.5';

        Then, I tried various methods to strip the time component from the date. Here are the various techniques for doing this, along with their generated results:

        DATE(MAKEDATE(YEAR($(vTEST)), MONTH($(vTEST)), DAY($(vTEST))), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
        DATE(FLOOR($vTEST)), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
        DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05" <======== THIS is what I wanted

        A Qlikview datetime is represented by a floating point number with the date on the integer side of the decimal point, and the time on the fractional side. I honestly thought the FLOOR function would do what I want, but it left the minutes untouched, which resulted in the variable still having a time component. The only way I could get the time completely stripped is illustrated in the last example. Have I mentioned how much I hate working in Qlikview?

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        S Offline
        S Offline
        Stefan Kusters
        wrote on last edited by
        #8

        I wonder that any of these expressions returns something, since none of them has balanced parentheses. On the other hand, I have never heard of "Qlikview" (fortunately), and perhaps this "language" can't cope with balanced parentheses :laugh:

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          Marc Clifton wrote:

          "oh wow, this is so cool, 4 levels of parens!"

          And your geeky friends would have mocked you because there are 5 levels... :laugh:

          Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

          K Offline
          K Offline
          kmoorevs
          wrote on last edited by
          #9

          If he were counting parens, 4 would be the average between the left and right side. :confused: edit: sorry, didn't see the post below which mentions this. :-O

          "Go forth into the source" - Neal Morse

          1 Reply Last reply
          0
          • M Marc Clifton

            John Simmons / outlaw programmer wrote:

            DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF')

            In my geeky teens I would have thought, "oh wow, this is so cool, 4 levels of parens!" and shown it to all my friends (erm, wait, what friends???) who would have gone "wow, that IS cool!" (if I had any friends.) Now in my geeky 50's I'm with you -- I look at that and think, wow, what BS is this?

            Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

            R Offline
            R Offline
            raddevus
            wrote on last edited by
            #10

            qlik example

            DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF')

            This is the necessary stage of declarative programming* that occurs right before AI takes over and writes all the code for us. :rolleyes: Yes, it's like SQL and yes I hate SQL also*. :laugh: <bumpersticker>Real Devs Hate SQL</bumpersticker>

            1 Reply Last reply
            0
            • R realJSOP

              I created a datetime variable like so

              LET vTEST = '2018-09-05 13:27:14.5';

              Then, I tried various methods to strip the time component from the date. Here are the various techniques for doing this, along with their generated results:

              DATE(MAKEDATE(YEAR($(vTEST)), MONTH($(vTEST)), DAY($(vTEST))), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
              DATE(FLOOR($vTEST)), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
              DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05" <======== THIS is what I wanted

              A Qlikview datetime is represented by a floating point number with the date on the integer side of the decimal point, and the time on the fractional side. I honestly thought the FLOOR function would do what I want, but it left the minutes untouched, which resulted in the variable still having a time component. The only way I could get the time completely stripped is illustrated in the last example. Have I mentioned how much I hate working in Qlikview?

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              W Offline
              W Offline
              Worried Brown Eyes
              wrote on last edited by
              #11

              How about

              dayname(vTEST)

              Assuming / is OK instead of -

              1 Reply Last reply
              0
              • R realJSOP

                I created a datetime variable like so

                LET vTEST = '2018-09-05 13:27:14.5';

                Then, I tried various methods to strip the time component from the date. Here are the various techniques for doing this, along with their generated results:

                DATE(MAKEDATE(YEAR($(vTEST)), MONTH($(vTEST)), DAY($(vTEST))), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
                DATE(FLOOR($vTEST)), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
                DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05" <======== THIS is what I wanted

                A Qlikview datetime is represented by a floating point number with the date on the integer side of the decimal point, and the time on the fractional side. I honestly thought the FLOOR function would do what I want, but it left the minutes untouched, which resulted in the variable still having a time component. The only way I could get the time completely stripped is illustrated in the last example. Have I mentioned how much I hate working in Qlikview?

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                W Offline
                W Offline
                Worried Brown Eyes
                wrote on last edited by
                #12

                Does this work for you?

                SET DateFormat='YYYY-MM-DD';

                LET vTEST = '2018-09-05 13:27:14.5';

                dayname(vTEST)

                1 Reply Last reply
                0
                • M Marc Clifton

                  John Simmons / outlaw programmer wrote:

                  DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF')

                  In my geeky teens I would have thought, "oh wow, this is so cool, 4 levels of parens!" and shown it to all my friends (erm, wait, what friends???) who would have gone "wow, that IS cool!" (if I had any friends.) Now in my geeky 50's I'm with you -- I look at that and think, wow, what BS is this?

                  Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #13

                  I'm somewhere between my teens and 50's and two parens would've been fine for me ;p

                  Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                  1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    John Simmons / outlaw programmer wrote:

                    YYYY-MM-DD HH:MM:SS.FFF

                    Seriously? The format strings don't differentiate between "month" and "minute"? :wtf: 💩


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    V Offline
                    V Offline
                    Vincent Maverick Durano
                    wrote on last edited by
                    #14

                    Perhaps the feature "common sense" was integrated. If it sees HH, then the next format will treat minutes regardless of the casing ;P

                    1 Reply Last reply
                    0
                    • R realJSOP

                      I created a datetime variable like so

                      LET vTEST = '2018-09-05 13:27:14.5';

                      Then, I tried various methods to strip the time component from the date. Here are the various techniques for doing this, along with their generated results:

                      DATE(MAKEDATE(YEAR($(vTEST)), MONTH($(vTEST)), DAY($(vTEST))), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
                      DATE(FLOOR($vTEST)), 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05 00:27:00.000"
                      DATE(NUM(DATE(FLOOR($(vTEST)) 'YYYY-MM-DD HH:MM:SS.FFF') = "2018-09-05" <======== THIS is what I wanted

                      A Qlikview datetime is represented by a floating point number with the date on the integer side of the decimal point, and the time on the fractional side. I honestly thought the FLOOR function would do what I want, but it left the minutes untouched, which resulted in the variable still having a time component. The only way I could get the time completely stripped is illustrated in the last example. Have I mentioned how much I hate working in Qlikview?

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                      M Offline
                      M Offline
                      Mark Miller
                      wrote on last edited by
                      #15

                      This will give you the date portion of the string:

                      LET vTEST = '2018-09-05 13:27:14.5';
                      LET vResult = Date(vTEST, 'YYYY-MM-DD'); <-- vResult = 2018-09-05

                      Also, 'MM' for months, 'mm' for minutes.

                      Sincerely, -Mark

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups