Report usign vs Code

I will design a Report in vs code,
But i will like to know hwre to add the SETCURRENT KEY command.
This is an example

dataset
{
dataitem("Proyeccion Matteriales ";"Proyeccion Matteriales ")
{
DataItemTableView = sorting("Item No.") WHERE (Tipo = FILTER('PROYECCION REPORTE'));

Answers

  • PhoguePhogue Member Posts: 76
    edited 2020-07-07
    You can do this in the "OnPreDataItem" trigger for your DataItem. This triggers before the records in your DataItem are fetched
  • DenSterDenSter Member Posts: 8,307
    You can add the SETCURRENTKEY command anywhere that you want. What is important here is to first understand what you want to accomplish, and then we can help you figure out what you need to do.
  • Speed_JuliusSpeed_Julius Member Posts: 3
    Thank you for your answer, what I try to do, it's group the items and have a Totals by item.
    In C/Side environment I created a keys in the table and then using this key in the Report for create a group.
    But this is my First report using VS code
  • DenSterDenSter Member Posts: 8,307
    edited 2020-07-07
    It works the same in VSCode, all of the triggers that you had in C/SIDE are also available in AL, and the syntax of the programming language is the same as well. So if you used to put a SETCURRENTKEY in OnAfterGetRecord, you can do the same thing in AL. Go to the dataitem that you need, put your cursor in there and start typing the word 'trigger' and then 'on' -> intellisense should drop down a list of triggers that you can create there.
    ep8l7krckl9q.png

    Is there a reason why you use SETCURRENTKEY to sort, when there is a property for that at the dataitem level?
  • Speed_JuliusSpeed_Julius Member Posts: 3
    Thak you very much.
    Is there a reason why you use SETCURRENTKEY to sort, when there is a property for that at the dataitem level? Because i will like to goup item and create totals
  • DenSterDenSter Member Posts: 8,307
    If you specify the key in the sorting property, there is no need for also using SETCURRENTKEY
Sign In or Register to comment.