Skip to content

Commit

Permalink
Merge pull request #118 from Solanki-Manish/Sharing-PowerAutomateSamples
Browse files Browse the repository at this point in the history
Utility flow to extract number by length
  • Loading branch information
Katerina-Chernevskaya authored Jan 7, 2025
2 parents 9c545ad + 87d9ec0 commit 1788c8d
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 0 deletions.
77 changes: 77 additions & 0 deletions samples/utility-flow-to-extract-number-by-length/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Utility flow to extract number by length

## Summary

This sample is a reusable child cloud flow that can be used for extracting a number by its length from a string. This flow takes input string and length of a digit or number to be extracted an its input parameters. This child flow can be called from the parent flow with the appropriate input parameters.

![Flow overview](/samples/utility-flow-to-extract-number-by-length/assets/flow-overview.png "Flow overview")

## Applies to

![Power Automate](https://img.shields.io/badge/Power%20Automate-Yes-green "Yes")

## Compatibility

![Premium License](https://img.shields.io/badge/Premium%20License-Not%20Required-green.svg "Does not use Premium license")
![On-Premises Connectors](https://img.shields.io/badge/On--Premises%20Connectors-No-green.svg "Does not use on-premise connectors")
![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-Not%20Required-green.svg "Does not use custom connectors")

## Contributors

* [Manish Solanki](https://github.com/Solanki-Manish)

## Version history

Version|Date|Comments
-------|----|--------
1.0|Jan 2, 2025|Initial release

## Prerequisites

The caller parent flow should be solution aware to call this child flow using "Run a Child Flow" action.

## Minimal Path to Awesome

### Import Solution

* [Download](./solution/utility-flow-to-extract-number-by-length.zip) the `.zip` from the `solution` folder
* [Import](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/import-update-export-solutions) the `.zip` file using **Solutions** > **Import Solution**.

### Using the source code

You can also use the [Power Apps CLI](https://docs.microsoft.com/powerapps/developer/data-platform/powerapps-cli) to pack the source code by following these steps:

* Clone the repository to a local drive
* Pack the source files back into a solution `.zip` file:

```bash
pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder --processCanvasApps
```

Making sure to replace `pathtosourcefolder` to point to the path to this sample's `sourcecode` folder, and `pathtodestinationfile` to point to the path of this solution's `.zip` file (located under the `solution` folder)
* Within **Power Apps Studio**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed.

## Features

This sample illustrates the following concepts:

* Reusablility using child flow
* Perform string parsing to extract number by its length from a given input text or string
* Use of Select & Filter action
* Expression

## Help

We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you encounter any issues while using this sample, you can [create a new issue](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=utility-flow-to-extract-number-by-length&authors=@Solanki-Manish&title=utility-flow-to-extract-number-by-length).

For questions regarding this sample, [create a new question](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=utility-flow-to-extract-number-by-length&authors=@Solanki-Manish&title=utility-flow-to-extract-number-by-length).

Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=utility-flow-to-extract-number-by-length&authors=@Solanki-Manish&title=utility-flow-to-extract-number-by-length).

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-samples/samples/utility-flow-to-extract-number-by-length" aria-hidden="true" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[
{
"name": "pnp-powerplatform-samples-utility-flow-to-extract-number-by-length",
"source": "pnp",
"title": "Utility flow to extract number by length",
"shortDescription": "Extract number by its length from a given text or string.",
"url": "https://github.com/pnp/powerplatform-samples/tree/main/samples/utility-flow-to-extract-number-by-length",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/powerplatform-samples/tree/main/samples/utility-flow-to-extract-number-by-length",
"longDescription": [
"This sample is a reusable child cloud flow that can be used for extracting a number by its length from a given text or string."
],
"creationDateTime": "2025-01-02",
"updateDateTime": "2025-01-02",
"products": [
"Power Automate",
"Power Platform"
],
"tags": [
"reusability",
"string parsing",
"expression",
"extract number",
"child flow"
],
"categories": [
"CLOUD-FLOW"
],
"metadata": [
{
"key": "POWERAPPS-EXPERIMENTAL",
"value": "No"
},
{
"key": "POWERAPPS-PREMIUM",
"value": "No"
},
{
"key": "POWERAPPS-ONPREM",
"value": "No"
},
{
"key": "POWERAPPS-CUSTOMCONNECTOR",
"value": "No"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/powerplatform-samples/raw/main/samples/utility-flow-to-extract-number-by-length/assets/flow-overview.png",
"alt": "Flow overview"
}
],
"authors": [
{
"gitHubAccount": "https://github.com/Solanki-Manish",
"pictureUrl": "https://github.com/Solanki-Manish.png",
"name": "Manish Solanki"
}
],
"references": [
{
"name": "Microsoft Power Platform documentation",
"description": "Discover how to make the most of Microsoft Power Platform products with online training courses, docs, and videos covering product capabilities and how-to guides.",
"url": "https://learn.microsoft.com/power-platform/"
}
]
}
]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" OrganizationVersion="9.2.24113.160" OrganizationSchemaType="Standard" CRMServerServiceabilityVersion="9.2.24123.00148">
<Entities />
<Roles />
<Workflows />
<FieldSecurityProfiles />
<Templates />
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<CustomControls />
<EntityDataProviders />
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml version="9.2.24113.160" SolutionPackageVersion="9.2" languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" OrganizationVersion="9.2.24113.160" OrganizationSchemaType="Standard" CRMServerServiceabilityVersion="9.2.24123.00148">
<SolutionManifest>
<UniqueName>Utilityflow</UniqueName>
<LocalizedNames>
<LocalizedName description="Utility flow" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.0.0.0</Version>
<Managed>2</Managed>
<Publisher>
<UniqueName>PnP</UniqueName>
<LocalizedNames>
<LocalizedName description="PnP" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<EMailAddress xsi:nil="true"></EMailAddress>
<SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl>
<CustomizationPrefix>pnp</CustomizationPrefix>
<CustomizationOptionValuePrefix>89378</CustomizationOptionValuePrefix>
<Addresses>
<Address>
<AddressNumber>1</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
<Address>
<AddressNumber>2</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
</Addresses>
</Publisher>
<RootComponents>
<RootComponent type="29" id="{56205717-aeac-ef11-8a69-7c1e52577cf6}" behavior="0" />
</RootComponents>
<MissingDependencies />
</SolutionManifest>
</ImportExportXml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"properties": {
"connectionReferences": {},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "undefined",
"parameters": {
"$authentication": {
"defaultValue": {},
"type": "SecureObject"
},
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Button",
"inputs": {
"schema": {
"type": "object",
"properties": {
"text": {
"description": "Please enter input string",
"title": "Input String",
"type": "string",
"x-ms-content-hint": "TEXT",
"x-ms-dynamically-added": true
},
"number": {
"description": "Please enter length of number",
"title": "Digits Length",
"type": "number",
"x-ms-content-hint": "NUMBER",
"x-ms-dynamically-added": true
}
},
"required": [
"text",
"number"
]
}
}
}
},
"actions": {
"Select": {
"type": "Select",
"inputs": {
"from": "@range(0,length(outputs('Compose')))",
"select": "@if(isInt(outputs('Compose')[item()]),outputs('Compose')[item()],'n')"
},
"runAfter": {
"Compose": [
"Succeeded"
]
}
},
"Compose": {
"type": "Compose",
"inputs": "@chunk(triggerBody()?['text'],1)",
"runAfter": {}
},
"Compose_1": {
"type": "Compose",
"inputs": "@split(join(body('Select'),''),'n')",
"runAfter": {
"Select": [
"Succeeded"
]
}
},
"Filter_array": {
"type": "Query",
"inputs": {
"from": "@outputs('Compose_1')",
"where": "@and(not(empty(item())),equals(length(item()),triggerBody()?['number']))"
},
"runAfter": {
"Compose_1": [
"Succeeded"
]
}
},
"Respond_to_a_Power_App_or_flow": {
"type": "Response",
"kind": "PowerApp",
"inputs": {
"schema": {
"type": "object",
"properties": {
"output": {
"title": "Output",
"type": "string",
"x-ms-content-hint": "TEXT",
"x-ms-dynamically-added": true
}
},
"additionalProperties": {}
},
"statusCode": 200,
"body": {
"output": "@{outputs('Compose_2')}"
}
},
"runAfter": {
"Compose_2": [
"Succeeded"
]
}
},
"Compose_2": {
"type": "Compose",
"inputs": "@if(empty(body('Filter_array')),'',first(body('Filter_array')))",
"runAfter": {
"Filter_array": [
"Succeeded"
]
}
}
}
},
"templateName": null
},
"schemaVersion": "1.0.0.0"
}
Loading

0 comments on commit 1788c8d

Please sign in to comment.