Options

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

  • Options
    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
  • Options
    DenSterDenSter Member Posts: 8,304
    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.
  • Options
    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
  • Options
    DenSterDenSter Member Posts: 8,304
    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?
  • Options
    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
  • Options
    DenSterDenSter Member Posts: 8,304
    If you specify the key in the sorting property, there is no need for also using SETCURRENTKEY
Sign In or Register to comment.