How to filter a long string that is split

I have a string from Brultech GEM that I can split with the & deliminator.
n=00012915&m=5234702&wh_1=153454.32&p_1=3&wh_2=14839.24&p_2=20&wh_3=46336.37&p_3=0&wh_4=134758.34&p_4=11&wh_5=161041.46&p_5=0&wh_6=121477.05&p_6=197&wh_7=123890.64&p_7=0&wh_8=1695.32&p_8=0&wh_9=88036.15&p_9=68&wh_10=122949.71&p_10=64&wh_11=85653.85&p_11=0&wh_12=36438.74&p_12=0&wh_13=42235.43&p_13=1&wh_14=134104.41&p_14=114&wh_15=138359.79&p_15=8&wh_16=128390.08&p_16=2&wh_17=67164.58&p_17=0&wh_18=156724.70&p_18=8&wh_19=43067.42&p_19=3&wh_20=27711.98&p_20=3&wh_21=41503.41&p_21=192&wh_22=103937.92&p_22=0&wh_23=149379.56&p_23=2&wh_24=125592.45&p_24=166&wh_25=50748.13&p_25=85&wh_26=20449.79&p_26=1&wh_27=20676.12&p_27=4&wh_28=11427.20&p_28=0&wh_29=33011.10&p_29=0&wh_30=94501.75&p_30=0&wh_31=97257.79&p_31=114&wh_32=18965.52&p_32=0&v=123.8

I only want the item (P_24=) and its value. I can split this into individual substrings, but I can not figure out how to filter only the P_24 value.
Any help would be appreciated.

Simple after the split use a switch node like this:
Screenshot 2024-12-06 at 1.20.28 PM

Here is the flow

[{"id":"453ffebef9cf238f","type":"inject","z":"05a89d30924df06f","name":"sample data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"n=00012915&m=5234702&wh_1=153454.32&p_1=3&wh_2=14839.24&p_2=20&wh_3=46336.37&p_3=0&wh_4=134758.34&p_4=11&wh_5=161041.46&p_5=0&wh_6=121477.05&p_6=197&wh_7=123890.64&p_7=0&wh_8=1695.32&p_8=0&wh_9=88036.15&p_9=68&wh_10=122949.71&p_10=64&wh_11=85653.85&p_11=0&wh_12=36438.74&p_12=0&wh_13=42235.43&p_13=1&wh_14=134104.41&p_14=114&wh_15=138359.79&p_15=8&wh_16=128390.08&p_16=2&wh_17=67164.58&p_17=0&wh_18=156724.70&p_18=8&wh_19=43067.42&p_19=3&wh_20=27711.98&p_20=3&wh_21=41503.41&p_21=192&wh_22=103937.92&p_22=0&wh_23=149379.56&p_23=2&wh_24=125592.45&p_24=166&wh_25=50748.13&p_25=85&wh_26=20449.79&p_26=1&wh_27=20676.12&p_27=4&wh_28=11427.20&p_28=0&wh_29=33011.10&p_29=0&wh_30=94501.75&p_30=0&wh_31=97257.79&p_31=114&wh_32=18965.52&p_32=0&v=123.8","payloadType":"str","x":250,"y":120,"wires":[["8df98d0763a8cc3e"]]},{"id":"8df98d0763a8cc3e","type":"split","z":"05a89d30924df06f","name":"Split using &","splt":"&","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","property":"payload","x":430,"y":120,"wires":[["064f28617445342b"]]},{"id":"064f28617445342b","type":"switch","z":"05a89d30924df06f","name":"dose it contain p=24","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"p_24","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":660,"y":120,"wires":[["b4505c2a3f08a110"]]},{"id":"b4505c2a3f08a110","type":"debug","z":"05a89d30924df06f","name":"debug 3526","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":120,"wires":[]}]

Thank You, It works. I have tried that same option and it did not work for me. Maybe because I was splitting the string in the tcp in node? I dont know, but this works, Thank You!
edit: I think I was using a capital P instead of a small p in the switch node.

If you could help me with one more step? All I need is the value so to change the P_24= (value) to a json {"value":()}So my automation system (Homeseer) can read the value.
Thanks again.

So add another split node and split it at the = then use a change node to build what you want it to look like

Great, but how to change a changing variable, The P_24 stays the same but the value always changes. So in the change node I Search for ? as it always changes value.

This is all new to me, as that is probably obvious.

In a change node
select change
search for P_24=
replace with blank value

If this is all new to you, you may benefit from watching the essentials videos.

Thanks, This will remove the p_24 and change to "", but I need the value and how do you search for a changing string item (value of p_24)

you use

Then you remove the p_24= as shown using a change node.

You then have the changing value in th msg.payload message property.

Thank You for your help.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.