Pass multiple input from the dashboard

From the coding guide, I find that it is possible to pass multiple values through in one pson data. But when I try to set the values on my dashboard through a slider, I can only access the Resource “user_input” instead of the values “a” and “s”, so I cannot change them properly.
I know that I can separate them into two resources and send them separately, but is there any ways to put them together and control them through sliders?

Here are my code and the snapshot for the slider settings

  thing["user_input"] << [](pson& in)
  {
    if(in["a"].is_empty()) //avoid slider reset when input is not available
    {
      in["a"]= (int) A;
    }
    else
    {
      if(A!= (int)in["a"])
      {
        int new_a = (int) in["a"];
        A =  new_a;
        Serial.println(A);
      }
    }
    if(in["s"].is_empty()) //avoid slider reset when input is not available
    {
      in["s"]= (int) S;
    }
    else
    {
      if(S!= (int)in["s"])
      {
        int new_s = (int) in["s"];
        S =  new_s;
        Serial.println(S);
      }
    }
  };

image

I have the same doubt.

I tried two different ways, but to no avail.

int max_nivel_agua;
int altura_sensor;

thing["dados_entrada"] << [](pson& in){

//  Fist attempt:

            if(in["altura_sensor"].is_empty()){
                in["altura_sensor"] = altura_sensor;
            } else {
                altura_sensor = in["altura_sensor"];
            }

            if(in["max_nivel_agua"].is_empty()){
                in["max_nivel_agua"] = max_nivel_agua;
            } else {
                max_nivel_agua = in["max_nivel_agua"];
            }
            
//  Second attempt:

//            bool A = in["altura_sensor"].is_empty();
//            bool B = in["max_nivel_agua"].is_empty();
//  
//            if(A){
//                in["altura_sensor"] = altura_sensor;
//            } else {
//                altura_sensor = in["altura_sensor"];
//            }
//
//            if(B){
//                in["max_nivel_agua"] = max_nivel_agua;
//            } else {
//                max_nivel_agua = in["max_nivel_agua"];
//            }

};

It seems the only solution is to separate them into two pson inputs at the moment, but at least it works :slightly_smiling_face:.

Will have a solution for that soon :wink: