Hello,
I have an app that will need to make use of Imperial values for distance measurements.
Example: 1' 3 1/8" (one foot, three and one eighth inches)
How can I give the user the ability to select text fractions ("7/8", etc.) but perform math on their selection?
Ideally, I'd like to take things like "1/2" - "1/4" = "1/4" (NOT .25)
Thanks!
Solved! Go to Solution.
Wow. Just figured this one out. Hopefully useful to others.
Set your trigger (OnStart/OnVisible/OnSelect/Etc.):
ClearCollect(colFracConvert, {imperial: "0", metric:0}, {imperial: "1/16", metric:1/16}, {imperial: "1/8", metric:1/8}, {imperial: "3/16", metric:3/16}, {imperial: "1/4", metric:1/4}, {imperial: "5/16", metric:5/16}, {imperial: "3/8", metric:3/8}, {imperial: "7/16", metric:7/16}, {imperial: "1/2", metric:1/2}, {imperial: "9/16", metric:9/16}, {imperial: "5/8", metric:5/8}, {imperial: "11/16", metric:11/16}, {imperial: "3/4", metric:3/4}, {imperial: "13/16", metric:13/16}, {imperial: "7/8", metric:7/8}, {imperial: "15/16", metric:15/16} );
Set Dropdown Control Items Property to:
colFracConvert.imperial
Insert a (hidden) helper Textbox Control with Text Property set to:
LookUp(colFracConvert, measurement1.Selected.Value = imperial, metric ) - LookUp(colFracConvert, measurement2.Selected.Value = imperial, metric )
Special sauce:
Set the "Difference" Textbox Control Text Property to:
If( Value(hiddenHelper.Text) < 0, "-" & LookUp(colFracConvert, Value( Last( Split(hiddenHelper.Text,"-").Result ).Result) = metric, imperial ), "+" & //You could leave this line out if the "+" doesn't matter to your use case LookUp(colFracConvert, Value(hiddenHelper.Text) = metric, imperial ) )
Whew! Been chewing on that one for a couple days. First time really using text wranglers like Last(Split()).
Enjoy!
Wow. Just figured this one out. Hopefully useful to others.
Set your trigger (OnStart/OnVisible/OnSelect/Etc.):
ClearCollect(colFracConvert, {imperial: "0", metric:0}, {imperial: "1/16", metric:1/16}, {imperial: "1/8", metric:1/8}, {imperial: "3/16", metric:3/16}, {imperial: "1/4", metric:1/4}, {imperial: "5/16", metric:5/16}, {imperial: "3/8", metric:3/8}, {imperial: "7/16", metric:7/16}, {imperial: "1/2", metric:1/2}, {imperial: "9/16", metric:9/16}, {imperial: "5/8", metric:5/8}, {imperial: "11/16", metric:11/16}, {imperial: "3/4", metric:3/4}, {imperial: "13/16", metric:13/16}, {imperial: "7/8", metric:7/8}, {imperial: "15/16", metric:15/16} );
Set Dropdown Control Items Property to:
colFracConvert.imperial
Insert a (hidden) helper Textbox Control with Text Property set to:
LookUp(colFracConvert, measurement1.Selected.Value = imperial, metric ) - LookUp(colFracConvert, measurement2.Selected.Value = imperial, metric )
Special sauce:
Set the "Difference" Textbox Control Text Property to:
If( Value(hiddenHelper.Text) < 0, "-" & LookUp(colFracConvert, Value( Last( Split(hiddenHelper.Text,"-").Result ).Result) = metric, imperial ), "+" & //You could leave this line out if the "+" doesn't matter to your use case LookUp(colFracConvert, Value(hiddenHelper.Text) = metric, imperial ) )
Whew! Been chewing on that one for a couple days. First time really using text wranglers like Last(Split()).
Enjoy!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
195 | |
70 | |
51 | |
41 | |
30 |
User | Count |
---|---|
255 | |
120 | |
97 | |
91 | |
78 |