Forums: [SOLVED] button passing arrays btwn server tab and client after tab using result[] - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] button passing arrays btwn server tab and client after tab using result[] Rate Topic: -----

#1 User is offline   heilman 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 28-February 15
  • Gender:Male

Posted 15 November 2018 - 12:27 PM

How do you pass an array [] when using a button from the server tab to client after tab using the result[]

Example:

Server Tab
---------------

string [] names = new string[25];

names[0] = "John";
names[1] = "Mark";
names[2] = "Frederick";

result["names"] = names; <<<<<< get run time ERROR cannot implicitly convert type 'string[]' to runnerDotNEt.XVar


Client After tab
----------------------

var names = result["names"];
alert('names[0]= " + names[0]);


Any feedback / thoughts appreciated.

Best
Mark
Big Timber, MT - USA
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16112
  • Joined: 03-February 03
  • Gender:Male

Posted 15 November 2018 - 07:43 PM

Try something like this:

dynamic names = XVar.Array();
names.InitAndSetArrayItem("John",1);
names.InitAndSetArrayItem("Mark",2);
names.InitAndSetArrayItem("Frederick",3);
result["names"] = names;
Best regards,
Sergey Kornilov
0

#3 User is offline   heilman 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 28-February 15
  • Gender:Male

Posted 14 December 2018 - 06:21 PM

This is a little after the fact, but what I ended up doing was a bit of a work around, but a cool one...


On the server side I built a string with a field delimiter ( in my case I used the | char )

then on the after server side I used javascript split function to process the array...

the array having names etc...

and fast...

worked...

Best
Mark
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users