cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ErikH63
Resolver I
Resolver I

Hex to decimal conversion

Hello,

 

Does anyone know if there is a way to convert a hexadecimal to decimal in flow?  I am still a noob at flow.

 

Thanks,

    -Erik

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @ErikH63 

 

It is possible to do this, although not as easy as you would expect. Please see the following flow:

https://ibb.co/bPGX9RD

HexToDec.png

 

Because this is somewhat complicated to recreate I have copied the contents of the scope for you, so if you want to recreate this your end, you need to do the following:

  1. Create an Initialize Variable action, name the variable Decimal
  2. Copy the code below into your clipboard, and then add a new action to your flow, click on "My Clipboard" and then press CTRL-V. Then the "HexToDec" scope will appear and you can paste it in.

You cannot put variables in a scope, which is why you have to create that part yourself.

Here is the code for the scoped section:

{"id":"14f6f66f-e620-4b12-86aa-cf5e-c83ac028","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"HexToDec","operationDefinition":{"type":"Scope","actions":{"Hex":{"type":"Compose","inputs":"474318F","runAfter":{},"description":"The Hex Number to be converted"},"DecToHexMapping":{"type":"Compose","inputs":[{"Dec":0,"Hex":"0"},{"Dec":1,"Hex":"1"},{"Dec":2,"Hex":"2"},{"Dec":3,"Hex":"3"},{"Dec":4,"Hex":"4"},{"Dec":5,"Hex":"5"},{"Dec":6,"Hex":"6"},{"Dec":7,"Hex":"7"},{"Dec":8,"Hex":"8"},{"Dec":9,"Hex":"9"},{"Dec":10,"Hex":"A"},{"Dec":11,"Hex":"B"},{"Dec":12,"Hex":"C"},{"Dec":13,"Hex":"D"},{"Dec":14,"Hex":"E"},{"Dec":15,"Hex":"F"}],"runAfter":{"Hex":["Succeeded"]},"description":"Mapping of decimal numbers to hexidecimal"},"HexPower":{"type":"Compose","inputs":[1,16,256,4096,65536,1048576,16777216,268435456,4294967296,68719476736,1099511627776,17592186044416,281474976710656,4503599627370496],"runAfter":{"DecToHexMapping":["Succeeded"]},"description":"Array of Multiplication Powers"},"Apply_to_each":{"type":"Foreach","foreach":"@range(0,length(outputs('Hex')))","actions":{"HexMultiplier":{"type":"Compose","inputs":"@outputs('HexPower')[item()]","runAfter":{"filterDecHexMapping":["Succeeded"]},"description":"Get the hex multiplier for current iteration"},"Increment_variable":{"type":"IncrementVariable","inputs":{"name":"Decimal","value":"@mul(first(body('filterDecHexMapping'))['Dec'], outputs('HexMultiplier'))"},"runAfter":{"HexMultiplier":["Succeeded"]},"description":"Add the created decimal to the variable"},"CurrentHexChar":{"type":"Compose","inputs":"@substring(outputs('Hex'), sub(sub(length(outputs('Hex')), item()),1),1)","runAfter":{},"description":"The current character of the hexidecimal number"},"filterDecHexMapping":{"type":"Query","inputs":{"from":"@outputs('DecToHexMapping')","where":"@equals(item()['Hex'], outputs('CurrentHexChar'))"},"runAfter":{"CurrentHexChar":["Succeeded"]},"description":"Find the Decimal Number that is equal to the Hex"}},"runAfter":{"HexPower":["Succeeded"]},"description":"Iterate through each character of the hex number"},"Decimal_Converted":{"type":"Compose","inputs":"@variables('Decimal')","runAfter":{"Apply_to_each":["Succeeded"]}}},"runAfter":{"Initialize_variable":["Succeeded"]}}}

Let me know how you get on.

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

View solution in original post

CFernandes
Most Valuable Professional
Most Valuable Professional

Hey @ErikH63 

 

You cannot Format a number out of box.

 

If you have office script enabled it is possible.

 

Script - 

 

function main(workbook: ExcelScript.Workbook, hexString:string)
{
  // Your code here

 

  var yourNumber = parseInt(hexString, 16);
 
  return yourNumber;
}
 
CFernandes_0-1620806819940.png
CFernandes_1-1620806838128.png

If you are new to Office Script then I did a demo recently for a User Group - You can find it at https://www.youtube.com/watch?v=afmE0JEtoU8&list=PLlNMfcMu9Cv61XBVCDio1NSRqLO-g5ZGn&index=5 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

View solution in original post

17 REPLIES 17
v-duann-msft
Community Support
Community Support

Hi @ErikH63

 

Thank you for posting.

 

According to your description, you would like to convert hex to decimal using flow. If any misunderstanding, please kindly let me know.

 

I’m afraid it’s impossible to archive your purpose in flow as there is no formula or action supported. But I found a workaround for you. You can try PowerApps instead.

ClearCollect(Hex2Dec,{Hex:"1",Dec:1},{Hex:"2",Dec:2},{Hex:"3",Dec:3},{Hex:"4",Dec:4},{Hex:"5",Dec:5},{Hex:"6",Dec:6},{Hex:"7",Dec:7},{Hex:"8",Dec:8},{Hex:"9",Dec:9},{Hex:"A",Dec:10},{Hex:"B",Dec:11},{Hex:"C",Dec:12},{Hex:"D",Dec:13},{Hex:"E",Dec:14},{Hex:"F",Dec:15});

 

You can also go to below thread for reference:

Solved: convert Hex to Ascii text - Power Platform Community (microsoft.com)

 

Hope the content above may help you.

 

Best regards,

Anna

Thanks Anna, you have it correct.  In my research I did find the PowerApp method, but I was really hoping to do it in a flow.  Thanks for confirming that a flow won't work.

 

-Erik

Hi @ErikH63 

 

It is possible to do this, although not as easy as you would expect. Please see the following flow:

https://ibb.co/bPGX9RD

HexToDec.png

 

Because this is somewhat complicated to recreate I have copied the contents of the scope for you, so if you want to recreate this your end, you need to do the following:

  1. Create an Initialize Variable action, name the variable Decimal
  2. Copy the code below into your clipboard, and then add a new action to your flow, click on "My Clipboard" and then press CTRL-V. Then the "HexToDec" scope will appear and you can paste it in.

You cannot put variables in a scope, which is why you have to create that part yourself.

Here is the code for the scoped section:

{"id":"14f6f66f-e620-4b12-86aa-cf5e-c83ac028","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"HexToDec","operationDefinition":{"type":"Scope","actions":{"Hex":{"type":"Compose","inputs":"474318F","runAfter":{},"description":"The Hex Number to be converted"},"DecToHexMapping":{"type":"Compose","inputs":[{"Dec":0,"Hex":"0"},{"Dec":1,"Hex":"1"},{"Dec":2,"Hex":"2"},{"Dec":3,"Hex":"3"},{"Dec":4,"Hex":"4"},{"Dec":5,"Hex":"5"},{"Dec":6,"Hex":"6"},{"Dec":7,"Hex":"7"},{"Dec":8,"Hex":"8"},{"Dec":9,"Hex":"9"},{"Dec":10,"Hex":"A"},{"Dec":11,"Hex":"B"},{"Dec":12,"Hex":"C"},{"Dec":13,"Hex":"D"},{"Dec":14,"Hex":"E"},{"Dec":15,"Hex":"F"}],"runAfter":{"Hex":["Succeeded"]},"description":"Mapping of decimal numbers to hexidecimal"},"HexPower":{"type":"Compose","inputs":[1,16,256,4096,65536,1048576,16777216,268435456,4294967296,68719476736,1099511627776,17592186044416,281474976710656,4503599627370496],"runAfter":{"DecToHexMapping":["Succeeded"]},"description":"Array of Multiplication Powers"},"Apply_to_each":{"type":"Foreach","foreach":"@range(0,length(outputs('Hex')))","actions":{"HexMultiplier":{"type":"Compose","inputs":"@outputs('HexPower')[item()]","runAfter":{"filterDecHexMapping":["Succeeded"]},"description":"Get the hex multiplier for current iteration"},"Increment_variable":{"type":"IncrementVariable","inputs":{"name":"Decimal","value":"@mul(first(body('filterDecHexMapping'))['Dec'], outputs('HexMultiplier'))"},"runAfter":{"HexMultiplier":["Succeeded"]},"description":"Add the created decimal to the variable"},"CurrentHexChar":{"type":"Compose","inputs":"@substring(outputs('Hex'), sub(sub(length(outputs('Hex')), item()),1),1)","runAfter":{},"description":"The current character of the hexidecimal number"},"filterDecHexMapping":{"type":"Query","inputs":{"from":"@outputs('DecToHexMapping')","where":"@equals(item()['Hex'], outputs('CurrentHexChar'))"},"runAfter":{"CurrentHexChar":["Succeeded"]},"description":"Find the Decimal Number that is equal to the Hex"}},"runAfter":{"HexPower":["Succeeded"]},"description":"Iterate through each character of the hex number"},"Decimal_Converted":{"type":"Compose","inputs":"@variables('Decimal')","runAfter":{"Apply_to_each":["Succeeded"]}}},"runAfter":{"Initialize_variable":["Succeeded"]}}}

Let me know how you get on.

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

CFernandes
Most Valuable Professional
Most Valuable Professional

Hey @ErikH63 

 

You cannot Format a number out of box.

 

If you have office script enabled it is possible.

 

Script - 

 

function main(workbook: ExcelScript.Workbook, hexString:string)
{
  // Your code here

 

  var yourNumber = parseInt(hexString, 16);
 
  return yourNumber;
}
 
CFernandes_0-1620806819940.png
CFernandes_1-1620806838128.png

If you are new to Office Script then I did a demo recently for a User Group - You can find it at https://www.youtube.com/watch?v=afmE0JEtoU8&list=PLlNMfcMu9Cv61XBVCDio1NSRqLO-g5ZGn&index=5 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

Thank you, @Paulie78 that is definitely not as easy as I thought it might be.  I need to study this and then get back to this post.  -Erik

Thanks, @CFernandes  this is an interesting idea I will see if this will work for me. I will watch the video thank you very much for the response.  -Erik

@CFernandes ,this worked really well and video was great, thanks for showing me this it opens a bunch of new doors.    -Erik

Hello @CFernandes, I used the script idea you gave me, but I found an issue.  I can run this script fine when I am run it via my form in PowerApps but if anyone else runs this script the flow fails with the error:  Script not found. It may have been unshared or deleted.
clientRequestId: d0812d74-0586-4ea0-a5e9-9cac30d91bef

 

Do you happen to know how to deal with this, since I am not sure who runs this I cannot add owners to flow.

 

Thanks,  -Erik

CFernandes
Most Valuable Professional
Most Valuable Professional

@ErikH63 Hey Mate,

 

I think I understand your problem. 

 

The Power Apps connection work under the context of the user who launched the APP and Excel script is stored in your OneDrive, which the user cannot access.

 

I have not tried your excat scenario but you can try to create a child flow and share the connection(I will try your scenario on Monday).

 

You can have a look at my video tutorial in which I explain sharing of connections in Power apps. https://powerusers.microsoft.com/t5/Webinars-and-Video-Gallery/Avoid-Authentication-Prompts-when-Dep... 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

CFernandes
Most Valuable Professional
Most Valuable Professional

Hey @ErikH63,

 

I created a video in which I explain why you are facing this problem - You can find the video at https://www.youtube.com/watch?v=hmtlUFRg9Ic 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thank you so much, this is above and beyond just helping.   I really appreciate this!!!   I will view it and post when I am done. 

 

-Erik

Hi @CFernandes, one question, I have to know who will be running this for sharing, correct?  The issue with that is that I do not know who will be running it since it is a utility for a Sharepoint group.  Sorry to make this so difficult.

 

Thanks,

    -Erik

CFernandes
Most Valuable Professional
Most Valuable Professional

@ErikH63 If you use the parent child approach as mentioned in my video and manage run only users the Flow will always run under the user you have specified. 

Can I follow that with one more question, I am not sure if you are able to answer. I do not know how the user is setup,  so I am wondering if I end up leaving the company will the script stop working?  I guess there is some job security it this. 😉

 

Thank you again @CFernandes 

Hello @CFernandes , I am trying to call the ParentHex and ChildHex from a Sharepoint List PowerApp canvas form, is there a trick to this since I can seem to find the ParentHex, I can only find my Flows? The app was created in the sharepoint list, it is not in my apps.

 

Thanks,

    -Erik

Hi Paulie, this has stopped working, looks like the syntax might be off with a recent update?

drkmccy_3-1673279606431.png

 

VictorIvanidze
Community Champion
Community Champion

Use "Format number" action as shown here: https://blog.magnetismsolutions.com/blog/isaacnichols/2020/01/31/formatting-numbers-in-power-automat...

________________________________________________________

Welcome to my web site.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (734)