Page 1 of 1

GetInValue Index in Webserver component macros

Posted: Sat Aug 19, 2017 8:41 am
by streammaster
Hi All,

Could somebody explain me the functionality behind the "index" BYTE in the Web server component macro "GetInValue"?
I'm receiving data, but I tried a few options and I noticed that 0, 1 and 2, as the index parameter, would filter the data in function return (this was a trial and error exercise since I couldn't find any example):

http://127.0.0.1:88/?0=hallo so if the index is =0 then the hallo will appear in the function return.

following web browsers requests will be filtered:

http://127.0.0.1:88/?1=good day
http://127.0.0.1:88/?2=hi

but anything else like:
http://127.0.0.1:88/?AB=something else
http://127.0.0.1:88/?3=hallo from 3

will appear.
The similar is if the index is 1 or 2 but any other number would not have any influence, in this case, every data after "=" will appear.
This is puzzling me and really I'm not sure what I can do with an index?

Thanks,

Re: GetInValue Index in Webserver component macros

Posted: Sat Aug 19, 2017 11:15 am
by kersing
Index is the position of the input value in the list of input values.

For http://website/?p=first&q=second
Index 0 should return first and index 1 should return second.

The number of input values will be limited to preserve memory, I guess the limit is 3 (0-2)

Re: GetInValue Index in Webserver component macros

Posted: Sat Aug 19, 2017 8:21 pm
by LeighM

Re: GetInValue Index in Webserver component macros

Posted: Sun Aug 20, 2017 6:52 am
by streammaster
Thanks, Kersing and Leigh

Leigh I had a look to examples which you suggested but this is for WIFI module, and it is handling it a bit differently components (i need the wired ethernet). Also, i was not able to connect the browser and really properly have running the example(i looked the example 3 the port should be 5000 but the browser is waiting only - look like something is broken in the flowcode).
I had a look the flowcode and In this example, the index used is "1", and according to the example, it is relating to the character "1" after "?" and before "=": "?1=" everything after "=" is passed as the value.

This is a bit different than how Kersing explained, his example should be like this then:

http://website/?0=first&1=second&2=third part

so the GetInValue will return following:

for index 0 ---> "first"
for index 1 ---> "second"
for index 2 ----> "third+part"

Is this understanding correct?

However, I noticed that the index will behave a bit odd if the actual web page return is different than 0,1,2. In this case, it will quite randomly return a string after "=".

Also, the "Example 3" has in the java script declared %0 (parameter set by Flowcode web) but in the main, there is no %0 sent the only %1 for the value of the potentiometer reading (sensor).

I will post separate post related to the example which I built but I have a few issue with the WEB component.

The suggestion which I have for the Flowcode help files is to try to provide an example for use of any functions as well as return values instead just to name obviously. In particular as an example, for the GetInValue Index should be stated firstly that ONLY 0,1,2 are valid numbers in the word (defined as any number from 0-254 what is obviously wrong presumption). In the same help should provide the HTTP syntax which will create correct use of this function.

Anyway, after 2 days of playing around this mystery looks may be fixed, another 1000 to be solved.

Thanks for the help!