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

Поділитися
Вставка
  • Опубліковано 20 січ 2025

КОМЕНТАРІ • 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....

  • @0xByteKnight
    @0xByteKnight 2 роки тому

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

  • @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);

  • @govind5067
    @govind5067 Рік тому

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

  • @1738RM
    @1738RM 2 роки тому

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

    • @Hougaard
      @Hougaard  2 роки тому

      Glad you liked it!

  • @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?

  • @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.

  • @lowefraser1324
    @lowefraser1324 7 місяців тому

    What about applying multiple filters? How is that achieved?

    • @Hougaard
      @Hougaard  7 місяців тому

      To the same field? With filter groups

    • @lowefraser1324
      @lowefraser1324 7 місяців тому

      @@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.

  • @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 UA-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.