Hi,
Thanks for creating this component. I am stuck trying to export to multiple sheets. Here is a picture of the action. The “Workbook_Get BinaryDate2” causes an error: “Object reference not set to an instance of an object”.
Can you tell me what I am doing wrong?
Thanks,
Glenn
Hi Glenn
I don't think you got the data type set up correctly.
You should define it like in this video.
If you still cannot get it going, would you mind sending me your .oml file?
Hanno
Hi Glenn,
Thanks for posting your question.
The reason for the error is the Worksheet is being passed to the Workbook parameter in Workbook_GetBinaryData2.
You can't separately extract a worksheet, you can only extract a whole workbook.
Having said that, if you just want the one worksheet, you can delete the other worksheets before extracting the workbook.
Kind regards,
Stuart
Hi Stuart,
Thanks for the reply and information. I need to export data from 3 different aggregates to individual worksheets. Is that possible?
It is possible.
You are currently passing Aggregate.List in the ToObject() action, but you need to pass in a Record list as per the documentation here.
Hope this helps.
Another note: looking at the image you shared, you only need to call Workbook_GetBinaryData() once at the end.
Hi Hanno,
Thanks for the advice and information. I read through the documentation recommended about the Record List. I found an example provided in a Traditional module with a Record List. However, I can’t seem to recreate one in a Reactive module. The local variable I created is a list from a structure.
This is my action. I have tried ListAppendAll and an Assign to populate the list.
Unfortunately, the excel it downloads contains this unexplainable number. Though the record count is correct. Lol
I can't get it to download one sheet with the correct data, much less 2 or more. Any help would be greatly appriciated.
You still need to make that EmployeeType variable a list of type record.
So when you are settng the data type, click in List, then Record, then select MAemployeeTypeExport.
Hope that helps.
OK. I think I was able to correctly go from list to Record.
How do you get data into this record? It can not be reference by an "Append".
I used an assign:
But it gives an error when it hits the "Cell_WriteRange":
Unable to cast object of type 'ssMetrics.STMAemployeeTypeExportStructure' to type 'OutSystems.HubEdition.RuntimePlatform.Db.RecordList'.
That is what I needed. Thank you so much for providing that video. I followed it and it works in the Action. With that change I was able to fill out the action to export to a Workbook with 3 different sheets with the data I needed. Here is the Action:
Here is the connection to the Record List that is populated by the ListAppend:
Thanks again for you assistance and advise. It is greatly appreciated.