0

I working a power automate flow and I've been struggling for quite a while to create a variable which I need to populate "County Name" in my word template. This flow allows a County staff member to fill out a form and then those MS Form responses dynamically populate in a word template. All of this works well but I'm struggling to create a variable which would populate "County Name" in my word template. I need the variable (dynamic content) to be able to capitalize the response from the MS Form

I need the dynamic content to be able to capitalize the name of County, so capitalize first word and second word. Example: "Washington County". I also need the variable to recognize when someone just puts "Washington" in the MS Form, instead of "Washington County", and then add County to the word template. I've tried quite a few combinations with toUpper and append string and not able to quite figure it out. Can anyone help?

enter image description here enter image description here

Baby Yoda
  • 34
  • 6

1 Answers1

1

My suggestion, look at using the Advanced Data Operations connector.

There are a few ways to achieve what you're wanting but the easiest way is by using the Transform operation.

There are over 100 built-in functions that can be made use of through the framework and one of them is the Proper function.

It will also allow you to concatenate strings at the same time. However, that process seems quite clunky for your requirement given how do you know if County should be added? I'll leave that with you though.

https://www.statesolutions.com.au/custom-functions/

(On the String tab, scroll down to the Proper function)

This is a basic example ...

Flow

You can see I've initialised a variable with the relevant value.

I've then configured the transform function (it takes an array of objects) to take in your data along with a transformation definition.

That definition runs a set of functions to get the result you need. Rather than checking for County at the end, I just add it and then replace County County with County.

You can also see the Proper function in there, that's the key part that uppercases each word.

This will be made easier in future as there is an Evaluate operation coming and that will allow you to do it in much simpler terms.

https://www.statesolutions.com.au/c-script-evaluate/

That's looking to drop by the end of this month but is available now via the HTTP operation.

Result (with "county" in the provided value)

Result 1

Result (without "county" in the provided value)

Result 2

Skin
  • 9,085
  • 2
  • 13
  • 29
  • Hey Skin, thanks again for helping with this. I did find the Proper function and I don't think that works for Power Automate. I know it works for Power Apps but my understanding is that it doesn't work for Power Automate. When I used it, I got a 'Proper is not a valid function' error. – Baby Yoda Mar 17 '23 at 15:30
  • I've actually figured out that I don't need to do this because I've changed the way my data is collected. I do however have another question related to this same flow. It might be easier to ask it here than create a whole new question. I'm trying to set a Form response dynamic variable, like "County Name" and make it so the County name is tied to the County abbreviation. Example is "Washington County": "WC". But I'm missing the dynamic variable portion of this if that makes sense. How did I tie this to the respone of "County Name" on the form? – Baby Yoda Mar 17 '23 at 18:47
  • 1
    Just to be clear, the functions I am talking about aren’t in PA, they’re in the advanced data operations connector, hence why you got an error saying proper doesn’t exist. It is all powerful and waaaaay more comprehensive than standard PA data operations and functions. You can see I’ve created a clear example that works with Proper so if you had’ve followed the links, you would see the supporting documentation behind how it works. Keep that connector in mind for future challenges you may have. Well done on fixing it at the source though, that’s always the best approach. – Skin Mar 17 '23 at 19:17
  • As for your other issue, I’d suggest raising another question, too hard to help without additional context. – Skin Mar 17 '23 at 19:19
  • Ahh Gotcha. I saw that there is a free trial for advanced data operations but you have to pay after that so I didn't pay for it. But that makes sense now. – Baby Yoda Mar 17 '23 at 19:19
  • 1
    Yes but it’s hell cheap. – Skin Mar 17 '23 at 19:20
  • Agreed. Not too bad! – Baby Yoda Mar 17 '23 at 19:38