Forum Discussion
Santosh_25
3 years agoFrequent Visitor
Expression.Error: We cannot convert the value "" to type Table.
I am getting error for below code. let url="https://us11-csl-zweb01.amelia.com/api_jsonrpc.php", Body = "{ ""jsonrpc"": ""2.0"", ""method"": ""host.get"", ""params"": { ""output"": ""extend...
Santosh_25
3 years agoFrequent Visitor
Hi,
I want to handle the empty results from above code. Whenever their is no data in any column then column should give the result like null value.
v-jingzhang
Community Support
3 years agoHi Santosh_25
From your code, "Table1" is always an empty table which doesn't have the table column to be expanded. I think you want to expand the "result1" table right?
If my assumption is correct, you can use below code for "Table1". And replace Table1 with result1 in #"Expanded Column1" step.
= Table.FromRecords({
[Column1 = #table({"hostid", "proxy_hostid", "host", "status", "lastaccess", "ipmi_authtype", "ipmi_privilege", "ipmi_username", "ipmi_password", "maintenanceid", "maintenance_status", "maintenance_type", "maintenance_from", "name", "flags", "templateid", "description", "tls_connect", "tls_accept", "tls_issuer", "tls_subject", "proxy_address", "auto_compress", "custom_interfaces", "uuid", "tags"},{List.Repeat({null}, List.Count({"hostid", "proxy_hostid", "host", "status", "lastaccess", "ipmi_authtype", "ipmi_privilege", "ipmi_username", "ipmi_password", "maintenanceid", "maintenance_status", "maintenance_type", "maintenance_from", "name", "flags", "templateid", "description", "tls_connect", "tls_accept", "tls_issuer", "tls_subject", "proxy_address", "auto_compress", "custom_interfaces", "uuid", "tags"}))})]
})
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.