Structure for xls file

Structure for xls file

  

Hi 



I have solved the problem but I would like to know if there is a better way to do it. 


I have three entities that have several columns  and two of them are booleans. These entities were putting together in a sql block. Whenever someone do a search, it creates a new list to be used in the excel export . The problem is the fact we need that the columns in the excel with the "boolean" columns should be text as "Sim" (=yes) or "Não" (=no). Previously it appeared as TRUE/FALSE values. 

So I have created two local variables with List <name_of_structure> type, and designed the next logic shown below... (i have also added two more local variables of type text and use them in the assign). The only difference between the lists are the data type assigned to the 2 attributes (first list - both are boolean but in the second list the same attributes are of text type). It works well but I would like to know if there would be a better way to do this. Thanks. 


ps I have used two list clear way before the sql  bock to prevent the flooding of both lists!





Hello Jorge,

As you are using SQL (but this is possible also in Aggregates, you can create calculated fields of type Text that you fill, in the query, with 'Sim' or 'Não' depending on the boolean fields.

Than, on the export, you just select the fields you want to export.

I think it will be more performatic than the use of ForEach...

Cheers,
Eduardo Jauch

I need the variable to be boolean so I can use the checkbox (this is mandatory), the check box has a session variable of type boolean... that way it is not possible, I suppose. In the search part of the sql (in the where clause) I have set the filter as 

SyntaxEditor Code Snippet

and (@XXXXX=0 or <entity>.yyyyy=1)

the X IS AN input variable from the check box (a session variable) , and yyyyy is the attribute boolean (that will enter in the excel file)... so I need to transform this boolean type to the text type... thanks. :)



(i have tried with the case option, this work for another situation because in the front end it requires text... but this attribute requires to be boolean to be used in the front end)

Solution

Jorge,

You can ADD the new fields without removing the others...

Cheers,
Eduardo Jauch

Solution

Jorge,

Re-reading your answer, I started to thought that you didn't understood what I suggested.

You have an SQL that is fetching data to export to EXCEL.
The entity you are fetching have some fields, that are of type boolean, and you want to export as text.

Create a STRUCTURE to hold the fields you want to output from the SQL and in this structure, use TEXT fields, and if the boolean is True, set the text field to "Sim", otherwise, set it to "No".

I'm not saying to you to change the entity fields from boolean to text. And so, you can use the boolean fields to filter the results. You are just "adding" calculated fields to the output, as text, to use in the export.

Hope to be more clear now :)

Cheers,
Eduardo Jauch

Eduardo it has been a while i have followed your suggestion and managed to implement it 2 hours ago... you gave the hint in the second reply. Thanks. It is better as this prevents the use of an additional list. (More precisely: One clear list and one list append)