Assign variables from my Excel Folder..

Hi folks,

I have the below excel folder which I am bootstraping to my application and I would like to assign the below Vales to my Tour Start Date variable:

When Column F (Tour Started) Is true (as Highlighted) then Look at column A (Last Change) and  Assign to "StartDate" variable of my table "15/7/2019".

I want to do the same for the "Start Time" and also for Tour "End Date" and "End time" Which will be very similar logic if not the same.

Thank you in anticipation for your Help.

Tasos


Hello Anastasios

Which "variable" is that?

Did you create the bootstrap automatically? In this case, a list will be generated and saved to the database.
Or are you uploading a file?

It is just a matter of cycle (foreach statement) the output of your ExcelToRecordList and verifies the value of the corresponding attribute.

Cheers.

Hi Anastasios,

If i understand your issue correct, you want to use a bootstrap but your excel file is not identical in structure as your target table is.

For this you can change your Excel to match your tabledefinition or you can create a server action and translate your input to match your desired output.

I would create a structure matching your excel layout. Use excel to recordlist with that structure and the loop and perform the translation as you described.


Hope this will help you.


Eduardo Jauch wrote:

Hello Anastasios

Which "variable" is that?

Did you create the bootstrap automatically? In this case, a list will be generated and saved to the database.
Or are you uploading a file?

It is just a matter of cycle (foreach statement) the output of your ExcelToRecordList and verifies the value of the corresponding attribute.

Cheers.

Hi Eduardo,


Sorry I haven't explain that very well. 


I have a created a Bootstrap automatically. So my Users will upload an excel folder (as shown in my previous post) by a "Browse" and "Submit" button.

I then Created a local variable but I want to assign some of the values of my bootstrap to a different table.


Therefore I have another table named "Tours" which I would like to take information from my Bootstrap and assign them to some of the columns of my "Tours" table.


So to answer your question the variable I would like to assign is in a different table of my data.

 When Column F (Tour Started) Is true (as Highlighted) then Look at column A (Last Change) and  Assign to "StartDate" variable of my "Tours" table "15/7/2019".

So how do I type the above logic in my Assign Value to Assign the "15/7/2019" to my "Tour table "--> Start Date variable?

Thank you in anticipation

Tasos


Stefano Valente wrote:

Hi Anastasios,

If i understand your issue correct, you want to use a bootstrap but your excel file is not identical in structure as your target table is.

For this you can change your Excel to match your tabledefinition or you can create a server action and translate your input to match your desired output.

I would create a structure matching your excel layout. Use excel to recordlist with that structure and the loop and perform the translation as you described.


Hope this will help you.


Hi Stefano,

What you understood is correct :) .


It is the "translation" part which I am struggling and I need some help please?

Thanks

Tasos


Solution

Create a Server Action.

Step 1 is to use the ExcelToRecordlist. You need a structure matching your example for that.

Step 2 is to Loop through your recordlist. For each record, translate:

"When Column F (Tour Started) Is true (as Highlighted) then Look at column A (Last Change) and  Assign to "StartDate" variable of my "Tours" table "15/7/2019"."

This is a bunch of IF's or a switch.


Not sure this is clear to you? 

Solution

Hello Anastasios,

Let me try with more detail.

1. On the Screen/Server Action receiving the excel file, iterate through the List output of the ExcelToRecordList (that generates an Outsystems list based on a structure (that must match the excel structure)

2. For each record in the List being iterated, if it has a value that must be updated in the Tours entity, find the corresponding record in the Tours entity. Use an Aggregate filtered by something in Tours that identify a unique record.

3. If you found a record (your aggregate list output is not empty), update (with an assign) the attributes in the Current of the Tours aggregate the values, based on the values in the excel.

4. Update the Tours entity using the Current of the aggregate.

I am assuming only the "update" scenario, but you could adapt it to also create records in the Tours.

Hope this helps.

Cheers.

Thank you both for your prompt response and help

My question was regarding the content of the "If" statement but I havent explained it very well.

Thanks

Tasos