cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Automatic number conversion to string in object

former_member460045
Participant
0 Likes
902

Hello,

my issue is this.

In below coding (simplified), what is the reason that the property "status" is becoming a string?

The oData Field is a Integer.

var iStatus = parseInt(oView.byId("status").getSelectedKey(), 10); //get Status of select

oModel.create(sPath, {
//...
status: iStatus, 
//...
}, fnCallback...);

console.log(oModel.getProperty("status"); --> STRING 

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Hello Johannes,

console.log writes a message to the console by default

please use typeof operator to get the primitive type of the variable:

var status = oModel.getProperty("status"); 
console.log(typeof status);// expected output: "number" in your case
former_member460045
Participant
0 Likes

Hi,

thats exactly what I did. The data types in my description are identified by typeof operation.

I did'nt mention it and I cannot edit the question anymore.

Best regards Johannes