CopyPastor

Detecting plagiarism made easy.

Score: 0.8129238044615712; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2022-08-29
by SwethaKandikonda

Original Post

Original - Posted on 2021-10-25
by SwethaKandikonda



            
Present in both answers; Present only in the new answer; Present only in the old answer;

After reproducing from my end, I could able to achieve this using below flow.
First I tried to form an Array from the sample csv given and then I used condition action inside a for-each loop to loop through second column item and check for the condition.
![enter image description here](https://i.imgur.com/1oFp7er.png)
**RESULTS:**
![enter image description here](https://i.imgur.com/WXEfelU.png)
You can reproduce the same in your logic app using the below code-view ``` { "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Array": { "inputs": { "variables": [ { "name": "Array", "type": "array", "value": "@skip(split(outputs('Compose'),'\n'),1)" } ] }, "runAfter": { "Compose": [ "Succeeded" ] }, "type": "InitializeVariable" }, "Compose": { "inputs": "name,age\na1,34\na2,NULL\na3, \na4,''\na5,", "runAfter": {}, "type": "Compose" }, "Compose_2": { "inputs": "@variables('FinalArray')", "runAfter": { "For_each": [ "Succeeded" ] }, "type": "Compose" }, "FinalArray": { "inputs": { "variables": [ { "name": "FinalArray", "type": "array" } ] }, "runAfter": { "Array": [ "Succeeded" ] }, "type": "InitializeVariable" }, "For_each": { "actions": { "Condition": { "actions": { "Append_to_array_variable": { "inputs": { "name": "FinalArray", "value": "@{items('For_each')} - @{variables('IscorrectCSV')}" }, "runAfter": { "Set_IscorrectCSV_-_False": [ "Succeeded" ] }, "type": "AppendToArrayVariable" }, "Set_IscorrectCSV_-_False": { "inputs": { "name": "IscorrectCSV", "value": false }, "runAfter": {}, "type": "SetVariable" } }, "else": { "actions": { "Append_to_array_variable_2": { "inputs": { "name": "FinalArray", "value": "@{items('For_each')} - @{variables('IscorrectCSV')}" }, "runAfter": { "Set_IscorrectCSV_-_True": [ "Succeeded" ] }, "type": "AppendToArrayVariable" }, "Set_IscorrectCSV_-_True": { "inputs": { "name": "IscorrectCSV", "value": true }, "runAfter": {}, "type": "SetVariable" } } }, "expression": { "or": [ { "equals": [ "@slice(items('For_each'),add(indexOf(items('For_each'),','),1),length(items('For_each')))", "NULL" ] }, { "equals": [ "@slice(items('For_each'),add(indexOf(items('For_each'),','),1),length(items('For_each')))", " " ] }, { "equals": [ "@slice(items('For_each'),add(indexOf(items('For_each'),','),1),length(items('For_each')))", "''" ] }, { "lessOrEquals": [ "@length(slice(items('For_each'),add(indexOf(items('For_each'),','),1),length(items('For_each'))))", 0 ] } ] }, "runAfter": {}, "type": "If" } }, "foreach": "@variables('Array')", "runAfter": { "IscorrectCSV": [ "Succeeded" ] }, "type": "Foreach" }, "IscorrectCSV": { "inputs": { "variables": [ { "name": "IscorrectCSV", "type": "boolean" } ] }, "runAfter": { "FinalArray": [ "Succeeded" ] }, "type": "InitializeVariable" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": {}, "triggers": { "manual": { "inputs": { "schema": {} }, "kind": "Http", "type": "Request" } } }, "parameters": {} } ```
After the Last step you can send to storage account using `Create blob(V2)` Connection with .csv file extension and then send the same blob content using `Get blob content(V2)` Connection then Send an email.

Here are the screenshots of LogicApp ![enter image description here](https://i.imgur.com/wfBS5bE.png)
![enter image description here](https://i.imgur.com/Bidtq9S.png)
![enter image description here](https://i.imgur.com/OqKBkzb.png)
**In outlook:**
![enter image description here](https://i.imgur.com/Qk7jg9l.png)
**Here is the workflow** ``` { "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Create_CSV_table_2": { "inputs": { "format": "CSV", "from": "@variables('Array')" }, "runAfter": { "For_each_2": [ "Succeeded" ] }, "type": "Table" }, "Create_blob_(V2)": { "inputs": { "body": "@body('Create_CSV_table_2')", "headers": { "ReadFileMetadataFromServer": true }, "host": { "connection": { "name": "@parameters('$connections')['azureblob']['connectionId']" } }, "method": "post", "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files", "queries": { "folderPath": "/ch1container2408", "name": "TestSample1.csv", "queryParametersSingleEncoded": true } }, "runAfter": { "Create_CSV_table_2": [ "Succeeded" ] }, "runtimeConfiguration": { "contentTransfer": { "transferMode": "Chunked" } }, "type": "ApiConnection" }, "For_each_2": { "actions": { "Append_to_array_variable": { "inputs": { "name": "Array", "value": { "created_at": "@items('For_each_2')['created_at']", "funds": "@items('For_each_2')['funds']", "id": "@items('For_each_2')['id']", "pair": "@items('For_each_2')['market']", "price": "@items('For_each_2')['price']", "side": "@items('For_each_2')['side']", "volume": "@items('For_each_2')['volume']" } }, "runAfter": {}, "type": "AppendToArrayVariable" } }, "foreach": "@body('Parse_JSON')", "runAfter": { "Initialize_variable_2": [ "Succeeded" ] }, "type": "Foreach" }, "Get_blob_content_(V2)": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['azureblob']['connectionId']" } }, "method": "get", "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('/<Your Container>','/<Your File>.csv'))}/content", "queries": { "inferContentType": true } }, "runAfter": { "Create_blob_(V2)": [ "Succeeded" ] }, "type": "ApiConnection" }, "HTTP": { "inputs": { "method": "GET", "uri": "https://api.wazirx.com/api/v2/trades?market=btcusdt" }, "runAfter": {}, "type": "Http" }, "Initialize_variable": { "inputs": { "variables": [ { "name": "Array", "type": "array" } ] }, "runAfter": { "Parse_JSON": [ "Succeeded" ] }, "type": "InitializeVariable" }, "Initialize_variable_2": { "inputs": { "variables": [ { "name": "Table", "type": "array" } ] }, "runAfter": { "Initialize_variable": [ "Succeeded" ] }, "type": "InitializeVariable" }, "Parse_JSON": { "inputs": { "content": "@body('HTTP')", "schema": { "items": { "properties": { "created_at": { "type": "string" }, "funds": { "type": "string" }, "id": { "type": "integer" }, "market": { "type": "string" }, "price": { "type": "string" }, "side": {}, "volume": { "type": "string" } }, "required": [ "id", "market", "price", "volume", "funds", "created_at", "side" ], "type": "object" }, "type": "array" } }, "runAfter": { "HTTP": [ "Succeeded" ] }, "type": "ParseJson" }, "Send_an_email_(V2)": { "inputs": { "body": { "Attachments": [ { "ContentBytes": "@{base64(body('Get_blob_content_(V2)'))}", "Name": "@body('Create_blob_(V2)')?['Name']" } ], "Body": "<p>TABLE TEST</p>", "Subject": "Test", "To": "<To Address>" }, "host": { "connection": { "name": "@parameters('$connections')['office365']['connectionId']" } }, "method": "post", "path": "/v2/Mail" }, "runAfter": { "Get_blob_content_(V2)": [ "Succeeded" ] }, "type": "ApiConnection" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": { "$connections": { "defaultValue": {}, "type": "Object" } }, "triggers": { "manual": { "inputs": {}, "kind": "Http", "type": "Request" } } }, "parameters": { "$connections": { "value": { "azureblob": { "connectionId": "<Your ConnectionId>", "connectionName": "azureblob", "id": "<Id>" }, "office365": { "connectionId": "<Your ConnectionId>", "connectionName": "office365", "id": "<Your Id>" } } } } } ```

        
Present in both answers; Present only in the new answer; Present only in the old answer;