Skip to main content

Hi,

I’m currently developing a custom projection and this is how I currently have defined a structure for the Response.

structure AppointmentDetailsResponse {

attribute Latitude Number;
attribute Longitude Number;
attribute DatasetId Text;
attribute Technician Structure(TechnicianResponse);
attribute AdditionalRegion List<Structure(AdditionalRegion)>;
}

There are a few weird behaviors that I’m noticing:

  1. When I add an extra attribute to this AppointmentDetailsResponse structure (e.g. attribute SomeField) like this:
    structure AppointmentDetailsResponse {

    attribute Latitude Number;
    attribute Longitude Number;
    attribute DatasetId Text;
    attribute SomeField Text;
    attribute Technician Structure(TechnicianResponse);
    attribute AdditionalRegion List<Structure(AdditionalRegion)>;
    }

    and if hard code a value to it in the the logic
    response_.some_field := 'TEST';
    RETURN response_;

     I’m getting this error when I test out the projection:
    {
    "error": {
    "code": "DATABASE_ERROR",
    "message": "Database error occurred. Contact administrator.",
    "details": a
    {
    "code": 17001,
    "message": "Internal Error: Image is not in 8.1 format"
    }
    ]
    }
    }

    Even if I don’t set this field in the response and leave it blank, I still get this error.

  2. The other weird behavior is if I define the “SomeField” attribute at the end of the structure like this
     

    structure AppointmentDetailsResponse {
    attribute Latitude Number;
    attribute Longitude Number;
    attribute DatasetId Text;
    attribute Technician Structure(TechnicianResponse);
    attribute AdditionalRegion List<Structure(AdditionalRegion)>;
    attribute SomeField Text;
    }

    I get a different error message:
     

    {
    "error": {
    "code": "UNEXPECTED",
    "message": "Unexpected internal server error occurred."
    }
    }

As soon as I remove this attribute from the AppointmentDetailsResponse structure, everything works fine again.

 

Here is the the full code of structure definitions:
 

structure AppointmentDetailsResponse {
attribute Latitude Number;
attribute Longitude Number;
attribute DatasetId Text;
attribute Technician Structure(TechnicianResponse);
attribute AdditionalRegion List<Structure(AdditionalRegion)>;
attribute SomeField Text;
}

structure AppointmentDetailsRequest {
attribute Task Structure(Task);
attribute SiteId Text;
attribute LanguagePreference Text;
}

structure Task {
attribute City Text;
attribute CountryId Text;
attribute Patch Text;
attribute Postcode Text;
attribute Province Text;
attribute Street Text;
attribute TaskType Text;
attribute Priority Text;
attribute Technician Structure(TechnicianRequest);
}

structure TechnicianRequest {
attribute Id Text;
}

structure TechnicianResponse {
attribute ResourceId Text;
attribute IfsResourceId Text;
}

structure AdditionalRegion {
attribute RegionId Text;
}

structure LocationAddressDetails {
attribute LocationId Text;
attribute Street Text;
attribute Postcode Text;
attribute City Text;
attribute Province Text;
attribute CountryId Text;
}

Any insights would be helpful. Thanks!

Hi @mtoca,

 

structure AppointmentDetailsResponse {

attribute Latitude Number;
attribute Longitude Number;
attribute DatasetId Text;
attribute Technician Structure(TechnicianResponse);
attribute AdditionalRegion List<Structure(AdditionalRegion)>;
}

 

Here the last attribute “AdditionalRegion” is holding a list containing structures of “AdditionalRegion”, which is basically using the same name. Could you try changin the name of the attribute? 

Hope this helps!


Hi @Charith Epitawatta,

I have tried this but still getting the error.


Ran into the same issue as well. Haven’t found a solution yet.

Edit: I was able to find a solution to my problem, but not sure if the same will apply here.

I have the following 2 structures (there are more, but I don’t think they’re necessary for sharing in this case):
 

structure ResponseResourceShiftStruct {
implementation = "Utility";
attribute ResourceId Text {
format = uppercase;
maxlength = 100;
}
attribute ResourceType Enumeration(ResourceTypes.Individual);
attribute ResourceSeq Number;
attribute Company Text {
format = uppercase;
maxlength = 20;
}
attribute EmployeeId Text {
format = uppercase;
maxlength = 11;
}
attribute RegularShift List < Structure(ResponseRegularShiftStruct) > ;
attribute OnCallShift List < Structure(ResponseOnCallShiftStruct) > ;
}

structure ResponseStruct {
implementation = "Utility";
attribute ResourceId Text;
attribute Company Text;
attribute EmployeeId Text;
attribute ResourceShiftCreated Number;
attribute OnCallShiftCreated Number;
attribute NumberOfErrors Number;
attribute ErrorMessageDetails List < Structure(ErrorDetails) > ;
attribute ResourceShiftStruct Structure(ResponseResourceShiftStruct);
}

 

I received the same ‘Internal Error: Image is not in 8.1 format’ error when adding the following to the ResponseResourceShiftStruct as shown above:

attribute ResourceSeq Number;

However, when I switched this attribute to a Text attribute like so:
 

attribute ResourceSeq Text;

I no longer produced the error. Not sure if there is some sort of issues with having nested Structures and non-text attributes?

Just curious, do you still receive the same error if you were to switch your structure to the following by changing the Latitude and Longitude attributes to be of type Text?:

 

structure AppointmentDetailsResponse {

attribute Latitude Text;
attribute Longitude Text;
attribute DatasetId Text;
attribute SomeField Text;
attribute Technician Structure(TechnicianResponse);
attribute AdditionalRegion List<Structure(AdditionalRegion)>;
}

 


Hi ALL,

I also ran into the same issue when I tried to add a new attribute to a structure.
 

I resolved this issue by dropping the projection and redeploying it.


Reply