2

i am getting this error because i added so many arguments, i know it has a limit of 16 argument but i don't have 16 or more, yet i stil get the sam error. even when i used an array ( like some answers said to ) i still get the error.

here is the function that the error points to :

CODE :

  enum Gender { Male, Female }
  enum Status {New,Pending,Validated,ToRevalid}


function getPerson(bytes32 personAddress)
    public

    constant
    returns(bytes32,
    bytes32 email,
    bytes32 fname,
    bytes32 lname,
    uint index,
    bool deleted,
    Gender gender,
    string image,
    Status status,
    bytes32[13] details
    )
  {
    if(!isPerson(personAddress)) return;
    else{
      if(persons[personAddress].deleted == true) return;
      else{

      details[0]=persons[personAddress].RIM;
      details[1]=persons[personAddress].BirthCity;
      details[2]=persons[personAddress].BirthCountry;
      details[3]=persons[personAddress].FatherName;
      details[4]=persons[personAddress].MotherName;
      details[5]=persons[personAddress].Citizenship;
      details[6]=persons[personAddress].Residency;
      details[7]=persons[personAddress].Grade;
      details[8]=persons[personAddress].CorpCountryCode;
      details[9]= persons[personAddress].IntroducedBy;
      details[10]=persons[personAddress].HowIntroduced;
      details[11]=persons[personAddress].website;
      details[12]=persons[personAddress].DeceasedDate;
        return(
          personAddress,
          persons[personAddress].email,
          persons[personAddress].fname,
          persons[personAddress].lname,
          persons[personAddress].index,
          persons[personAddress].deleted,
          persons[personAddress].gender,
          persons[personAddress].image,
          persons[personAddress].status,
          details
        );
      }
    }

  }
1
  • 1
    You could split this in multiple getter methods.
    – ivicaa
    Feb 20, 2018 at 20:20

1 Answer 1

1

If you have a variable which is a struct, it doesn't count for a single variable but for as many variables as the number of member variables of the struct.

I see you have Gender and Status structs as some of your variables. Perhaps they have enough member fields to take the number of variables beyond 16.

3
  • 1
    Gender and Status are actually enums, i don't know if your idea stands but thanks. Feb 20, 2018 at 15:38
  • What happens if you initialize the array as details = [persons[personAddress].RIM, persons[personAddress].BirthCity, ...]? I wonder if it's assigning a local variable for every array element assignment.
    – Alex Sk
    Feb 20, 2018 at 15:45
  • I don't actually think that is possible but i know that details={[persons[personAddress].RIM,persons[personAddress].BirthCity,..} is possible but didn't try it yet. Feb 20, 2018 at 15:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.