21
Views
6
Comments
Solved
Does the length of a list data type have a limit?
Application Type
Reactive

I'm a bit confused while debugging an API response. When I used fetch() with javascript and logged the result to the console, I saw that a property called coordinates contained an array with 694 elements. However, when I used an OutSystems Service Action to call the same API, I noticed that the coordinates key didn’t return the same number of elements. I used a structure to hold the response values from the API. Does anyone know why this might be happening? 






ServiceStudio_gwS2ugAuEI.png
nkVErrwHEM.png
DsqgL8UD78.png
ServiceStudio_cwOouEstp0.png
ServiceStudio_IQRFbFUd5Y.png
2019-01-07 16-04-16
Siya
 
MVP
Solution

Can you set the Logging to Full in Service Center and check the Log File generated? This file will contain what is been sent and received.

2023-02-27 07-38-03
Muhammad Fadhli Azhar

I'm sorry, it turns out there was a difference in the request content when using JavaScript and when using the OutSystems REST API consumption. I have now managed to get the same result. Please forgive my oversight. 

2023-12-11 08-54-13
Neha Agrawal
Champion
AI Generated

@Muhammad Fadhli Azhar 

OutSystems can be a bit more of a stickler when reading the API's data compared to Node.js. If the coordinates array isn't perfectly formatted, OutSystems might get confused and miss some pieces, leading to fewer elements than you expect.

To figure it out, try this:

  1. Verify the Data Type of the List: 
    Double-check the data type you've assigned to the coordinates attribute within your OutSystems structure. 
    If you have defined coordinates as a List in OutSystems, ensure the "Data Type" of the list is correctly set to match the type of elements within the array (e.g., Integer, Decimal, or a custom structure if the elements are objects). 
  2. Analyze the Raw API Response in OutSystems: 
    Instead of immediately mapping to your structure, try logging the raw JSON response received by the OutSystems Service Action. This will allow you to see exactly what the API is sending to OutSystems and compare it directly to what you see in Node.js. You can often use a "Log Message" action with the ResponseBody of the API call. 
  3. Simplify your OutSystems Structure: 
    Temporarily create a very simple OutSystems structure with only the coordinates attribute defined as a Text data type. Log the value of this attribute. If you see the entire array as a single string, it indicates that OutSystems isn't automatically recognizing it as an array, pointing towards a structure definition issue.
  4. Compare Request Headers: 
    Compare the headers being sent by your Node.js fetch call and the OutSystems Service Action.
  5. Test with a Smaller Subset: 
    If possible, see if the issue persists with an API response that contains a significantly smaller number of elements in the coordinates array. This could help determine if there's a size-related limitation.
  6. Check if there's any custom logic or data transformation happening within your OutSystems Service Action after the API call but before the data is mapped to your structure. This logic might be inadvertently filtering or modifying the coordinates array 
  7. Check the OutSystems error logs carefully. It's possible that the deserialization process in OutSystems is encountering an issue with the large array and potentially logging an error or warning that could provide more details. 
  8. OutSystems settings could be the culprit: Take a peek at your OutSystems Service Action settings. There might be something there affecting how it handles the data.
This answer was AI-generated. Please read it carefully and use the forums for clarifications
2023-02-27 07-38-03
Muhammad Fadhli Azhar

Thanks for the suggestion @Neha Agrawal 

I am getting the same result now between using javascript and OutSystem service action. I was just careless with the request value while using the service action. I will be more careful next time

2023-06-13 12-29-43
Sakthivel P

Hi @Muhammad Fadhli Azhar,

If your Coordinates structure is not correctly set to handle a dynamic or larger array, only part of the data may be deserialized, or the rest could be silently discarded.

Can you pls make sure that you always getting the correct structure in Coordinates list like X coordinate and Y coordinate.

Inspect the raw API response by setting the Logging to Full in Service Center or use the LogMessage action to debug the issue.

2023-02-27 07-38-03
Muhammad Fadhli Azhar

I think you're right about the importance of matching the structure with the API response. However, it turns out the issue was simply due to me providing different values when using JavaScript and the OutSystems service action. I'll be more careful moving forward. Thank you for your suggestion

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.