Hello Dennis,
Hope you are well.
I am developing a Power Automate Flow that is fetching documents from SharePoint document library and returning results to Copilot Studio in a table format as below. I am using three parameters in flow 1. Title, 2. Product Category and 3. Document Type (e.g. SOP or a Form etc.).
Below table works fine if I have only one parameter e.g. Title.

Complete Flow

Now when I included two parameters e.g. "Title" and "document type" then I received error: Unable to process template language expressions in action 'Return_value(s)_to_Power_Virtual_Agents' inputs at line '0' and column '0': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#replace for usage details.'.
I used following code in last step of Flow, i.e Return Values to PVA.
replace(replace(replace(replace(replace(replace(replace(body('Create_HTML_table'), '<table><thead><tr><th>', '| '), '</th></tr></thead><tbody>', concat(' |',decodeUriComponent('%0A%0D'),'|-----------|:-----------:|',decodeUriComponent('%0A%0D'))), '</th><th>', ' | '), '<tr><td>', '| '), '</td><td>', ' | '), '</td></tr>', concat(' |',decodeUriComponent('%0A%0D'))), '</tbody></table>', '')

Could you help with a correction to below for more than one parameter in user question so that results can be communicated to user as a table in Copilot Studio bot.
Many thanks.
replace(replace(replace(replace(replace(replace(replace(body('Create_HTML_table'), '<table><thead><tr><th>', '| '), '</th></tr></thead><tbody>', concat(' |',decodeUriComponent('%0A%0D'),'|-----------|:-----------:|',decodeUriComponent('%0A%0D'))), '</th><th>', ' | '), '<tr><td>', '| '), '</td><td>', ' | '), '</td></tr>', concat(' |',decodeUriComponent('%0A%0D'))), '</tbody></table>', '')