Forum Discussion
Hayden_Jenkins
Oct 23, 2019Copper Contributor
Calculated Column Using Number Data to Return Different Values
Hi, I am trying to use a calculated column (that's using data from another calculated column) to return a string based on some simple conditions. Background: I have a powerapp that collects data ...
- Oct 23, 2019Gotcha. I would create a new column in that case, use flow to process or loop through the list and update the column to the appropriate value, then add the logic to the button to record the value in the list going forward so you don't have to maintain a flow and powerapp and it'll make more sense if anyone needs to go edit it later.
Flow would be started using flow button (You can run it manually when ready to go from the flow editor)
Throw in a getitems action to get all items in list.
Update Item action using the getitems ID this will add it to a loop.
You can then put a condition in front of it to handle the shifts based on the calculated date, or if your feeling randy figure out how to use a flow expression and do it in a single step. This is basically like calculated column nesting if's to set the value in a single action instead of using conditions.
You could basically do this flow for a single item, once you get it working, then go back and and in the get items part and do the loop through.
Another tip, don't forget to go in and set paging or pagination? Something like that so it allows to pull more than 100 records in the loop. It's in the settings of the getItems action i believe.
Oct 23, 2019
I’m not sure if it will trigger delegation warning or not but you can try wrapping your column on Value(column) function to convert it from text assuming that was the column output to a value so it can compare it properly.
- Hayden_JenkinsOct 23, 2019Copper Contributor
ChrisWebbTechThanks for the reply! I tried this but it still returns shift 3 every time.
- Oct 23, 2019Oh I was thinking you were doing this in PowerApps. I don't think you can reference a calculated column in another one since the value will probably be determined prior to it being saved, which means the value will be null. Go edit the item afterwards with something, and I bet it will then update with the proper value? That's how you can tell if that's the case.
- Hayden_JenkinsOct 23, 2019Copper Contributor
ChrisWebbTechAh I see. Is there any way you can think of to get around this? I've got quite a bit of data in here and would prefer not to start from scratch. I have been collecting data for the date, but didn't know how to compare it because it includes date and time. Is there a way to do this?