Hello
I am trying to get a filed updated by value ranges:
Hello FLMike
It was not working for me with the Trace() as you told me:
Trace("<2000")' above the Value line
Trace("<=10000") again above its sections valuel line
I get no output with sense in the monitored trace.
Or I dont get any output:
onSelect Button
-----------------------
Set(varTest,"");
If(
Trace(<= 2000),
Value(TextInput1.Text) <= 2000,
Set(varTest,"smaller then 2000"),
Trace(<= 10000),
Value(TextInput1.Text) <= 10000,
Set(varTest,"higher 2000 less + equal 10000"),
Trace(> 10000),
Value(TextInput1.Text) > 10000,
Set(varTest,"higher then 10000")
)
And I like to see the variable value as well (with other debugger you can do)...,
so not really working for me ;(
Cheers
Michael
😁No, why I would do that... I replaced the old IF with a switch, thats how it works 👍
Thats a shame as it shouldn't take that long to test the scenarios and would have helped out to tell you exactly what was broken but hey go the long way, what do I know...... oh wait..
I’m confused, did you wrap your IF statement in a Switch with the only case being ‘true’ and it somehow started working??
Hello ivan_apps
Thanks for the hint, makes it easier 😉
Cheers
Michael
Hello Michael
Thanks for the Trace() information, thats helpful in some circumstances otherwise I needed to test every variation to find ou whats working or not.
The trigger is a Button onSelect.
My solution on the en which was working is a Switch()
Switch(true,
Value(TextInputSum.Text) <= 2000, //FIRST CONDITION
Patch(InventoryAdjust_Main,LookUp(InventoryAdjust_Main,Identifier=DataCardValue24.Text),{ApproverGroup:{Value:"NoApprover"}});
// Requester don#t need approval <= 2000
Patch(InventoryAdjust_Main,LookUp(InventoryAdjust_Main,Identifier=DataCardValue24.Text),{Status:{Value:"Approved"}});
Value(TextInputSum.Text) >2000 And Value(TextInputSum.Text) <=10000, //SECOND CONDITION
Patch(InventoryAdjust_Main,LookUp(InventoryAdjust_Main,Identifier=DataCardValue24.Text),{ApproverGroup:{Value:"AccountManager"}});
Value(TextInputSum.Text) >10000, //SECOND CONDITION
Patch(InventoryAdjust_Main,LookUp(InventoryAdjust_Main,Identifier=DataCardValue24.Text),{ApproverGroup:{Value:"Director"}});
);
The idea with: Sum(Gallery1.AllItems,ValorAjuste) was still not working.
But thanks a lot for your hint !!!
Cheers
Michael
How are you defining "varID"? that seems like the key to your issue, you're doing a lookup to it on all scenarios. Do your choice values also not have spaces in between? if it doesn't match what's configured, i believe sharepoint will create the new choice value for you, but your filters may be hard-coded with spaces like "No Approver".
You also don't have to nest IF statements, you can simplify like this:
Can you please do me a favor @MD2024 and re-paste your code into Code Snipps </> so its easier to consume.
And I am going to focus on the one question for the title.
How is this code triggered? a button, onchange event what?
You said it doesn't update, which I assume means it doesn't hit any of these If places.
1. Does this happen in Dev, Test, Prod, all of the above?
If it happens in dev then do this
Above your If put
Trace("Above If Statement - " & TextInput2.Text);
This will tell you for 100% what its trying to do
Now in each section of the if's add a Trace statement so see if it hits any of them
Trace("<2000")' above the Value line
Trace("<=10000") again above its sections valuel line
Once you do this, if its in Dev, then hit the Stethescope and run Monitor.
Repro the issue
Go to the Monitor Tab in the Browser
Type Trace for the filter
see which ones get triggered,
Should take 5 minutes tops.
If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others
Cheers
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey
WarrenBelz
146,635
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional