backand

Error when running query in backand: not a valid constant


Hi when working in Backand I try to run the following query: { "object": "dr_persons", "q": { "person_type" : "4"
}, "fields": ["first_name", "last_name"] } person_type is a table in mysql db with "4" as a value.

When I run it I get this error: Errors in Query Please fix the following errors in the query:

not a valid constant for field person_type of object dr_persons

The only thing I can see is that when I sync my db it makes it a "float" which I can't change. Can anyone give me some direction on this?


Solution

  • The error message is due to the constant "4" being a string. According to the field type, float, it should be a number. Hence your query should be:

    { 
       "object": "dr_persons", 
       "q": { 
          "person_type" : 4
       }, 
       "fields": ["first_name", "last_name"] 
    }