Error "TypeError: Cannot read property 'ODP' of undefined" on node-red - scripting

I'm developing a program in node-red that gets tags from a database and should then "write" the value of them on a connected plc, but some tags are not passed due to this error "TypeError: Cannot read property 'ODP' of undefined" the script inside the node that from error is the following :
"msg.payload = {"value":[''+msg.payload[0].ODP+'']};
return msg;"
the tags are : OPD (string[30]) , DATA(string[10] , QUANT_INIZIALE DINT , QUANT_PROD DINT

The error implies that your input msg.payload to the function node is not an array.
It is not possible to see in the image you have posted, exactly which node the error is happening on, but if you attach a debug node before point you should be able to see what the input message looks like.

Related

Not full error message shown after importing RDF text snippet

I am new to GraphDB. I am trying to use SHACL validation by pasting my shapes into the text field in the "import RDF text snippet" function. The problem I have is that if there is an error not the entire error message is shown. I can see "..." at the end of the error message that is shown but the details of what has gone wrong seem to be missing.
This is what I get:
org.eclipse.rdf4j.sail.shacl.GraphDBShaclSailValidationException:
Failed SHACL validation
#prefix sh: <http://www.w3.org/ns/shacl#> .
_:node1gh8je8tbx1779741 ...
The "..." at the end of the message show that there is more to this error message (and according to the SHACL validation I can expect more details to be shown in the error message).
I have tried it in both MS Edge and Chrome so I don't think it's a browser issue. There doesn't seem to be anything to expand the message. In case it makes a difference, I use Windows 10.
The message is intentionally cut off, because the violation reports tend to be too long. For the full message you can check GraphDB main log in /logs directory.

Formik FieldArray error messages - React Native

I'm using Formik FieldArray as part of my form and would like to show error messages, I can access the error messages within a component via errors.familyMembers[0], which looks like
[{"first_name": "First Name is a required field", "last_name": "Last Name is a required field"}]
To show the error I have 2 parts where I need to extract the error message
isInvalid={fieldName in errors.familyMembers[0] && touched[fieldName]}
<FormErrorMessage
message={errors.familyMembers[0][fieldName]}
isVisible={touched[fieldName]}
/>
The problem is when the component is initially rendered errors.familyMembers[0] is undefined, which gives me the error
undefined is not an object (evaluating 'errors.familyMembers[0]')
Is there a way I can guard against undefined and have the messages show if available? Hope that makes sense
You can use Optional chaining, like:
isInvalid={errors?.familyMembers && fieldName in errors.familyMembers[0] && touched[fieldName]}
<FormErrorMessage
message={errors?.familyMembers?.[0][fieldName]}
isVisible={touched[fieldName]}
/>
The optional chaining operator (?.) enables you to read the value of a
property located deep within a chain of connected objects without
having to check that each reference in the chain is valid.

TypeError: Cannot read properties of undefined (reading 'maps')

I am trying to use the DistanceMatrixService from #react-google-maps/api. One of the required parameters is the 'travelMode'. However, when I tried setting 'travelMode' to 'DRIVING', it shows the following!
I tried doing
travelMode: google.maps.TravelMode.DRIVING
but it also throws a type error
TypeError: Cannot read properties of undefined (reading 'maps')
Here is a snippet of my code where I call the Distance Matrix Service.

why accessing property of database query output giving error in one system not in other system

max is select query result. And I am getting it as NULL.
var maxLevel = max[0].level; //This line is giving error in one system,
as "Cannot read property 'level' of undefined"
while no error in other system.
I want to get no error.
before getting max[0].level why don't you try console.log that max[0]. i am sure that way you can get the answer to your question, and check there is property which call level .And also it's better to add more information about your question.

Validating a non-existent field error in console

My problem is I am getting this error when I try to validate my fields with VeeValidate on my system.
Uncaught (in promise) Error: [vee-validate] Validating a non-existent field: "". Use "attach()" first.
at createError (vee-validate.esm.js?00d1:297)
at Validator._handleFieldNotFound (vee-validate.esm.js?00d1:2282)
at Validator.validate (vee-validate.esm.js?00d1:1959)
at ScopedValidator.validate (vee-validate.esm.js?00d1:3276)
at VueComponent.next (QueryAcademicForm.vue?f0b2:332)
at click (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-e5b3dc5a","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/QueryAcademicForm.vue (0.3f605440c8faec0820bd.hot-update.js:22), <anonymous>:364:25)
at invoker (vue.esm.js?efeb:2027)
at HTMLButtonElement.fn._withTask.fn._withTask (vue.esm.js?efeb:1826)
I tried to replicate it here on jsfiddle, it gives me same error but there is little bit difference in error message
Uncaught (in promise) Error: [vee-validate] Validating a non-existent field: "result". Use "attach()" first.
at Re (vee-validate.min.js:1)
at vn._handleFieldNotFound (vee-validate.min.js:1)
at vn.validate (vee-validate.min.js:1)
at ln.validate (vee-validate.min.js:1)
at a.validateBeforeSubmit ((index):355)
at click (eval at $a (vue.min.js:6), <anonymous>:2:4043)
at t (vue.min.js:6)
at HTMLButtonElement.Ir.t._withTask.i._withTask (vue.min.js:6)
One thing to notice that error is not on every instance of form-input component rather only on the last step.
The issue appears due to "in-place patch" strategy that Vue.js uses. This case is described in the VeeValidate documentation. Basically, you need to tell Vue.js to track all child components separately by setting unique value to the key attribute for each input element:
<form-input key="unique"></form-input>
Here is a working JSFiddle example.
In my case it did appear because my HTML dynamically renders based on the certain condition and I was using this piece of code <div v-if="condition"... > for dynamic rendering. Despite the fact I was using unique key.
To solve the issue, I've changed the v-if to v-show like this <div v-show="condition"... > and error's gone.
Reference