cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Can you preprocess a variable to use it in a formula?

Any help would be appreciated.

 

For sake of explanation, I have two tables (SharePoint Lists).  

 

Reminders tables 

 WhoDaysMsgSize
Reminder1Bob15Do your thingSmall
Reminder2Judy5Do the other thingMedium
Reminder3Jane11Do the last thingLarge
Reminder4Jane and Judy7Do SomethingMedium
Reminder5Bob6Do NothingSmall
Reminder6Steve2Just do itLarge

 

Cases

 SmallMediumLarge
Case 11/1/111/5/151/7/19
Case 22/6/142/7/221/6/44
Case 36/11/017/11/196/2/21
Case 45/10/1510/20/306/5/66
Case 51/1/233/2/115/6/15

 

In my flow, I want to be able to get the appropriate item(s) from the Reminders table (done), look at the value of the Size column (done), then get all of the items from the Cases table (done) and find the days for which the column (specified from the Size Column) match the equation of Today+Days.

 

For example, if the Flow is triggered for reminder 4, I want to be able to evaluate the "Medium" column in the cases table, and find any that match Today+7 and send a reminder to Jane and Judy.   

 

Most of that, I'm totally good with, but I can't find a way to specifically use the appropriate column.   I thought i could pull in the list and then do a foreach.   Probably not the most efficient, but doable.   If I use a variable called VarColumnName to store Medium (and correct for the horrible end users who put spaces in the real column names) is there any way to pre-process the variable so that the flow would get "items('ApplyToEach')?['Medium']

 
items('ApplyToEach')?[replace(variables('VarColumnName'),' ','_x0020_')]
4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Can you preprocess a variable to use it in a formula?

Hi @Vodomin,

 

Use expression as a parameter of variables() function is not workable.

As a workaround, you could create a Switch action to guide the Flow go to corresponding branches according to Size value of Reminders tables. For example:

Annotation 2020-06-10 112237.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Frequent Visitor

Re: Can you preprocess a variable to use it in a formula?

While I think that would work, it would nullify the intent of the workflow.   Part of my reason for making the workflow this way is to allow the users to modify the timings of their reminders and what reminders they choose without constant intervention to the flow.  If I use a switch like that, I'll have to update the flow any time they add or remove a reminder.  

 

I did receive some helpful input from a coworker who suggested I use an array, but I think it comes down to the same problem.  

As an example, I rewrote my Flow to illustrate the issue:

 

If I hard code the filter like this:

Using Text.png

 

Then I get the proper output:

using Text Output.png

 

But if I put the same text string into a variable, and use that as the query, I get nothing.   

with a variable.png

 

Again, much respect, appreciation, and admiration to anyone who can point me in the right direction.  

Highlighted
Super User II
Super User II

Re: Can you preprocess a variable to use it in a formula?

Hello @Vodomin 

 

When you get the column name into a variable, you can use the variable in the Filter Query field of the Get items action, where you get the cases.

 

So your Filter Query field could be: <variable ColumnName> eq <utcNow()+7 as 'yyyy-MM-dd'

Would that do the trick for you?

Kind regards, John

Highlighted
Frequent Visitor

Re: Can you preprocess a variable to use it in a formula?

I don't think so. At least I haven't been able to make that work.   

Here is the output of where I set the variable:

Vodomin_1-1593178337303.png

 

In the next step I do as you suggest (I think).  In this case I'm using the starts with and "3799-" just for the example..

Vodomin_2-1593178442610.png

But it doesn't return anything even though the item exists in the inputs.

 

Vodomin_3-1593178555956.png

 

And I don't think there is a way to see what it's actually processing.   

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (6,602)