TableValue extension method
I am using powerfx on premise with my own application. I have written some extension methods, but can't get an extension method up and running that returns a tablevalue. I want something like "LoadCSV(Path)" to be callable from powerfx formula. I asked copilot, tried various things. The main point seems to be that the tablevalue class is abstract. Has somebody done something similar and can me provide a sample or point me in the right direction? Any help would be appreciated , thank you.
Best Regards, Stefan
You are correct on TableValue part, you may need to implement that class so you can build TableValue over CSV, and for that function to be callable inside Power Fx expression, you would need to register your LoadCSV() function as Reflection function, see examples here https://github.com/microsoft/Power-Fx/blob/55aebe3cb13acd730659f0c8429272f115ccbd92/src/tests/Microsoft.PowerFx.Interpreter.Tests.Shared/CustomFunctions.cs#L481
Out of curiosity, can you tell us more about how you are leveraging Power Fx?
Thank you for your response, but it seems to me, that this returns a decimal value rather than a table value. I want to do something like this: With( { invoiceLines: GetInvoiceLines("INV-1001"), totalAmount: Sum(GetInvoiceLines("INV-1001"), Qty * Price) }, AddColumns( invoiceLines, "LineTotal", Qty * Price ) ) So the GetInvoiceLines should return a table value, which in your example, it doesn't.
I try to write a ETL, for example I have extension functions to call a rest service or to write to csv (not yet implemented).
so the execute function should return a tablevalue
public TableValue Execute() and here I have tried multiple ways to return a table value.