Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Need extended ph_split() function Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
gg102
Senior Member
Senior Member


Joined: January 29 2013
Location: United States
Online Status: Offline
Posts: 245
Posted: February 24 2024 at 13:38 | IP Logged Quote gg102

Dave,

As you know, I'm using Shelly devices. They have changed their responses to be more extensive and detailed.
Of course, the simple data I need is near the end of their list. To handle this, I need to do a lot of
complex substring functions to get the data I want. The better solution would be to use a
ph_split( ph_flattenjson(.......),.....) function.

The problem with the ph_split() function is that it ONLY returns to the [Local] Variables 1-10. Well, I'm
getting back 20-30 fields. Of course, I need something like field 25. Way out of range.

For Example:



Can you make something like a ph_split1() function that includes at the end, a parameter to put the
responses into something like:
1=locals(default). 2=temps, 3=globals?

In this example, I would use option 3 to put the data into globals 1-100. Quite sufficient room for all the
fields. This way, I can acquire the all the fields and read the one I want.

Syntax
ph_split1( data, sep, local-offset, destination )

Argument Description
data String. The data you would like split.
sep String. The separater character or string.
local-offset Integer. The starting index of the local variables to have the split strings copied into.
destination   Integer. 1=[locals]-default, 2=[temps], 3=globals


Thanks
w.


Back to Top View gg102's Profile Search for other posts by gg102
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum