SetFilter or SetRange, what to use and when in AL and Business Central

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ม.ค. 2025
  • Find more information at my blog www.hougaard.com or follow me on / ehougaard
    Source code can be found here: github.com/hou...

ความคิดเห็น • 33

  • @MrMark00024
    @MrMark00024 2 ปีที่แล้ว +6

    Great video, this one threw me a bit when I was leaning CAL. Would be good to do one showing when to use Reset or Clear.

  • @yuvsharma
    @yuvsharma 2 ปีที่แล้ว +1

    Nice and great video on the impact of type checking in the longer run.

  • @chriswatson2407
    @chriswatson2407 2 ปีที่แล้ว +1

    Thanks Erik. Still the best Pascal channel on yt....

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว

      Totally gonna quote you on that :)

    • @mauriciovillatoro9361
      @mauriciovillatoro9361 2 ปีที่แล้ว

      @@Hougaardby far the best BC AL Channel.

  • @0xByteKnight
    @0xByteKnight 2 ปีที่แล้ว

    Great video with good explanation! Finally I get the difference and will use it for building an app.

  • @1738RM
    @1738RM 2 ปีที่แล้ว

    Ive never come across AL programming before, seems very interesting !! Nice video :D

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว

      Glad you liked it!

  • @govind5067
    @govind5067 ปีที่แล้ว

    Hats Off Errik sir,
    I am new in this field and i wanted to be like you;

  • @carstenhansen3979
    @carstenhansen3979 2 ปีที่แล้ว +2

    SETRANGE: Both values included. With SETFILTER it is possible to exclude the limits.
    My favorite SETFILTER:
    SETFILTER("Ending date", '%1|%2..', 0d, WORKDATE);

  • @navnav3134
    @navnav3134 2 ปีที่แล้ว

    Dear Eric,
    How can we put the filter inside the filter pane?. for example onopen page put true inside filter pane for a boolean record, like saved view.
    Best Regards,
    NAV

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว +1

      That's just by adding a filter to record you're passing to page.run()

    • @navnav3134
      @navnav3134 2 ปีที่แล้ว

      @@Hougaard this will put the filter as background and we can not remove it.
      Anyway, I fix it by using the filtered record inside (settable view) function.
      Thanks for your reply dear.
      Nav

  • @hassansadiq3106
    @hassansadiq3106 ปีที่แล้ว

    Can someone tell please, how can we check for duplicate records in a tabls having multiple primary keys and throw error?

  • @lowefraser1324
    @lowefraser1324 7 หลายเดือนก่อน

    What about applying multiple filters? How is that achieved?

    • @Hougaard
      @Hougaard  7 หลายเดือนก่อน

      To the same field? With filter groups

    • @lowefraser1324
      @lowefraser1324 6 หลายเดือนก่อน

      @@Hougaard thank you, I was thinking of filtering the record on multiple fields, can you do that with set range?

  • @mauriciovillatoro9361
    @mauriciovillatoro9361 2 ปีที่แล้ว

    Hi Erik Nice Video,
    How do you Groups Records, like the "Group by" clause in SQL?

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว +1

      Only with the tree control, there's a video about that :)

    • @mauriciovillatoro9361
      @mauriciovillatoro9361 2 ปีที่แล้ว

      @@Hougaard Yes, I saw that video. Thanks.

  • @mauriciovillatoro9361
    @mauriciovillatoro9361 2 ปีที่แล้ว

    Hi Erik, is there any difference between do GL.SetRange("Posting Date", D, D2 ) or do GL.SetRange(GL."Posting Date", D, D2)?
    Thanks.

  • @JPColeman73
    @JPColeman73 2 ปีที่แล้ว

    Can it be imaginable to substitute setrange and setfilter in the future? Wouldn't it be easier to have something like the where clauses in sql? This would avoid having x lines with setfilter and setrange.

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว +3

      Several tables in BC are not SQL (virtual, temporary, CRM, CDS) so a common filter language still seems like a good idea.

    • @mauriciovillatoro9361
      @mauriciovillatoro9361 2 ปีที่แล้ว

      @@Hougaard HI, do you think SQL queries instead AL, support could be possible 🤔 in the future for BC?

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว +1

      Never say never :)

  • @phduck
    @phduck 2 ปีที่แล้ว +2

    YOU FORGOT TO TELL THEM THAT SetRange ALSO IS MORE PERFORMANT THAN THE OTHER OPTIONS!
    But your points of using the power of type checking is of course correct.

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว +2

      So, are you, once and for all, as the product group official representitive here on TH-cam , stating that:
      The SQL SELECT statement created from SetRange is performing better than the SQL SELECT statement created from SetFilter?

    • @phduck
      @phduck 2 ปีที่แล้ว +2

      @@Hougaard I am in no way in the authority to represent the product group.
      And I really hope we don't end up creating different SQL statements. But the runtime cost is cheaper since you don't have to parse the input text, does it matter in most cases? No, but let's find all arguments to steer people towards SetRange.

    • @Hougaard
      @Hougaard  2 ปีที่แล้ว +3

      But if it only the parsing cost we're talking about, then that's less than the deviation of the latency of the subsequently SQL operation.
      The reason I didn't mention this in the video, is that there has been soo many urban legends surrounding this, going all the way back to Peter Bang.... Someone have talking with someone saying that setfilter is .... than setrange.

    • @klauskaan6320
      @klauskaan6320 2 ปีที่แล้ว +1

      @@phduck I will buy the theoretical performance gain as my side argument in "why setrange is better!" :D

    • @BlackTigerAP
      @BlackTigerAP 2 ปีที่แล้ว

      There is no difference in performance. SQL statements are identical.