HERE API - Layer LINK_ATTRIBUTE2_FCN information 'undefined' - here-api

I am using HERE api to get information about geographic points. In my request I ask for multiple layers and for all of them I get information, expect for most of my points when I try to read the LINK_ATTRIBUTE2 layer, it says it is undefined:
let linkObject = routeLinks.get(linkId);
...
let linkAttribute2Group = linkObject.attributes['LINK_ATTRIBUTE2_FCN'][0];
The error:
(node:103736) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
The attributes part of my request looks like this:
attributes=ADAS_ATTRIB_FCn(HPX,HPY,HPZ,SLOPES,HEADINGS,CURVATURES,REFNODE_LINKCURVHEADS,NREFNODE_LINKCURVHEADS),LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE,VEHICLE_TYPES,URBAN,TRANSPORT_VERIFIED,TO_REF_NUM_LANES,FROM_REF_NUM_LANES),LINK_ATTRIBUTE2_FCn(FOUR_WHEEL_DRIVE,SCENIC_ROUTE,PARKING_LOT_ROAD,PARKING_AVAILABILITY,PRIORITY_ROAD,CARPOOL_ROAD,REVERSIBLE,EXPRESS_LANE,TRANSITION_AREA,EXPANDED_INCLUSION,DELIVERY_ROAD,TRUCK_ROAD_TYPE,BICYCLE_ACCESS,BICYCLE_PROTECTION_TYPE,BICYCLE_TRAVEL_DIR_OVERRIDE,SURFACE_TYPE,GENERALISED_BICYCLE_PATH),TRAFFIC_SIGN_FCn(VEHICLE_TYPES,TRAFFIC_SIGN_TYPE)
Why does HERE return undefined for a group of requested attributes? Is it because it does not have these information? I couldn't find anywhere in the documentation that the layer attribute group can be undefined. I saw that paticular attributes in layer are nullable, but not the whole layer attribute group.

Yes, it is possibility that link ID doesn't return any attribute for the specified layer(if it is incorrect or not coded in the map or doesn't exist). Would it be possible for you to share the specific link ID so that we can check the detail for it from the (linkObject).

Related

Firestore Rules - get the size of request parameters

In firestore, request.resource.data.size() is equivalent to the size of the document in its final form. My question is, how can I get the parameters that are being sent from the client?
Meaning, if I the client tries to update the property name, then I want to check if the client has updated name and the size of the parameters he sent is just one parameter. I would've used hasExact() if it existed, but the problem is that I'm not sure if there's an object the specifies the requested parameters.
With the current request.resource.data.size(), I'm not sure how can do the following operations:
Deny writing updatedAt property (which is being updated as the server timestamp on each update) without an additional property.
Deny updating a property that is already equivalent to the requested value.
It's difficult to tell from your question exactly what you want to do. It doesn't sound like the size of the update is the only thing you need to be looking at. Without a more concrete example, I am just going to guess what you need
But you should know that request.resource.data is a Map type object. Click through to the linked API documentation to find out what you can do with a Map. That map will contain all the fields of a document that's being updated by the client. If you want the value of one of those fields, you can say request.resource.data.f where f is the name of the field. This should help you express your logic.
If you want the value of an existing field of a document, before it's written, use the map resource.data, which works the same way.

API-PLATFORM - model with object serialized to string at endpoint

I faced the problem with generating React components with api-platform-generate-crud.
Model has property that is object email.
I have serializer that make my email object a string.
API endpoint is serving string.
It works for GET & POST.
When I try to generate React components error message is
TypeError: Cannot read property '0' of undefined
Looking deeper into it, looks like that generator still see my email as object not a string.
Any idea how I can force API to 'see' email property as string not object ?
The data model you define is authoritative. Types in the Hydra documentation reflect the ones in PHP classes.
Here, the email property is of type object. If you set the related data as a string somewhere, you don't respect this contract anymore. The Hydra documentation is not in sync with the returned data.
You can change the type of the email property in the Hydra documentation by decorating the api_platform.hydra.normalizer.documentation service.
But I would recommend to keep the PHP classes' structure of your entities as close as possible of the structure exposed through the API.
Your classes should reflect the output of the API. You can use custom data providers to deal with more complex data structure (ex: ORM entities) before hydrating the structure to expose.

How do I find out a field's type information for a 'record' in appmaker in Server script?

I'm trying to create a re-usable script for capturing record changes onSave with Server-side scripting. To do that, I need the model information for a given table, including what type each field is.
I have figured out how to get the model for my table and details for the fields:
var table = "Clients";
var myObject = app.models[table];
// Dump the properties of the 2nd field in the model
console.log("Field 2 properties: " + JSON.stringify(myObject["L"]["fields"]["1"]));
I see this:
{"name":"Client",
"key":"zzzkS1spSPKkRXMn",
"displayName":null,
"description":"Short name for client (must be unique)",
"type":{},
"required":false,
"uid":false,
"defaultValue":null,
"minLength":0,
"maxLength":null,
"integer":false,
"sortable":true,
"minValue":null,
"maxValue":null,
"regexp":null,
"regexpError":null,
"possibleValues":null,
"aggregationType":null
}
"type" looks like an empty property here and I can't seem to figure out how to get any reference to it to tell me what I need.
How do I get usable type information for a given field in a model?
Right now, App Maker doesn't expose an API to access the model metadata.
You snippet is actually accessing App Maker's internal state and might break in future releases (the "L" property is actually obfuscated by a JS compiler and not designed to be accessed from user land).
We know this kind of meta-programming is handy and this is something we might add in the future based on user feedback. Please feel free to submit a request feature in our issue tracker (https://developers.google.com/appmaker/support).

Update object attributes in twig

I already check this post
I have a similar problem
I have a variable object with attributes others objects
so I Have the main object and I want put null to one of their properties
I tried this options but they fail of course, before each line I put the error that give me
set object.other = null
--------------------------------------
Unexpected token "punctuation" of value "." ("end of statement block" expected)
set object["other"] = null
--------------------------------------
Unexpected token "punctuation" of value "[" ("end of statement block" expected)
set (object, 'other', null)
--------------------------------------
Only variables can be assigned to. Unexpected token "punctuation" of value "(" ("name" expected)
set object = object|merge({'other',null})
--------------------------------------
The merge filter only works with arrays or "Traversable", got "object" as first argument
Please Help
The first three of your examples are not valid Twig syntax, like the error messages say.
The fourth example, using Twig's merge filter, would work if your object was an array, a hash (i.e. {% set object = { other: 'something' } %}), or an instance of a Traversable class. Your object is none of these, as can be seen from the error message returned by Twig: 'The merge filter only works with arrays or "Traversable", got "object" as first argument.' Note also that you have a typo (as already mentioned by aferber): you have {'other', null} whereas you should have {'other': null} (or {other: null}).
Thus, what you are trying to do can't be done out-of-the-box in Twig. You need to either modify your class (e.g. create a method which sets the other property to null) or create a Twig extension. The question Adding a property to an object in twig has answers showing how you could approach these solutions.
A third possibility would be to modify your class so that the object is Traversable. Then you could use the merge filter.
Of course one more possibility is to stop trying to do this in Twig and do this e.g. in a controller (as already suggested by Frank B).
In order for this to work, object has to be an object in the first place. The error message to your last try (merge filter) clearly shows this isn't the case (in PHP, every object is Traversable). In addition, the object has to have a public property named other.
You should also pay attention to the difference between {'other',null} and {'other': null}.
After you have fixed all those problem (ie. made sure you assign an object to object first), the merge filter will work, just as it did in the question you linked to.

Biztalk Distinguished field issue

I'm passing a message in biztalk that is resulting in the following suspended message:
Inner exception: A failure occurred while evaluating the distinguished
field MessageStatus against the message part data. The message part
data does not contain at least one of the nodes specified by the XPath
expression (listed below) that corresponds to the distinguished field.
The cause for this error may be that the message part data has not
been initialized or that the message part data does not conform to the
message
In my orchestration I'm using a map that maps an ID called textID to the textID field in my constructed message "MessageAttempt". I also have a field called MessageStatus with the value set to "Nothing" not to be confused with .
After my map I use a message assignment shape to set the MessageAttempt.MessageStatus element to "Attempted" with the following code:
Message_MessageAttempt.MessageStatus = var_Attempt;
I been trying to figure this out all day. I have a similar ConstructedMessage/Transform/Assignment shape on a different branch in my orchestration set up the same and works just fine. I'm not sure what I could be missing.
The XPath functoin can't find the element. There are two possible reasons for this.
The element doesn't exist. If it doesn't exist, you have to create it first. You can do this In the map by setting its value property to <empty>, or using an empty String Concatenate functoid with its output into that node.
You should be able to verify this by going into the group hub, opening the suspended message, and viewing the message part. You'll find that it doesn't contain the node the XPath refers to.
The namespaces in the message are not qualified properly. XPath in orchestrations runs into issues if you don't use namespace prefixes for the message and just rely on the default/empty xmlns.

Resources