Search code examples
exportazure-logic-apps

How to export a query result without enumeration in Logic Apps?


I defined a workflow in Logic Apps which runs a query and export result to a csv file in blob storage.

However, I receive tiny floats as enumarated number.

For example : the value of the column is 0,000081 but I see it in the csv as "8.1E-05". ho can avoid this situation?

enter image description here

the JSON call is as below :

{
  "type": "Table",
  "inputs": {
    "from": "@body('SQL_sorgusu_çalıştırın_(V2)_1')?['resultsets']?['Table1']",
    "format": "CSV",
    "columns": [
      {
        "value": "@{item()?['Column1']}"
      },
      {
        "value": "@{item()?['Column2']}"
      },
      {
        "value": "@{item()?['COlumn3']}"
      },
      {
        "value": "@{item()?['Column4']}"
      },
      {
        "value": "@{item()?['FloatColumn']}"
      },
      {
        "value": "@{item()?['Column5']}"
      },
      {
        "value": "@{item()?['Column6']}"
      }
    ]
  },
  "runAfter": {
    "SQL_sorgusu_çalıştırın_(V2)_1": [
      "SUCCEEDED"
    ]
  }
}

I also check the options of "Create CSV" but there is no configuration for formatting.


Solution

  • Initially I have also got same values as you have :

    '

    the value of the column is 0,000081 but I see it in the csv as "8.1E-05". ho can avoid this situation?

    I do agree with @Skin you can simply use formatNumber() function to wrap values as it needs to be.

    Below is the design which worked for me:

    I have taken hardcoded input In compose, you can use yours:

    enter image description here

    You have to parse json to get values of each json property . For my input the Prase_Json Schema is :

    {
        "items": {
            "properties": {
                "name": {
                    "type": "string"
                },
                "val": {
                    "type": "number"
                }
            },
            "required": [
                "name",
                "val"
            ],
            "type": "object"
        },
        "type": "array"
    }
    

    Then used formatNumber(item()['val'], '0.000000', 'en-us'):

    enter image description here

    Output:

    enter image description here

    The values are as same as should be:

    enter image description here

    Then you can send the values to Blob Storage in next action/step.