# Sequelize.INTEGER field value passed (from Forest) as a string

**URL:** https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426
**Category:** Help me!
**Created:** [June 7, 2020, 9:38pm UTC](https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426 "2020-06-07T21:38:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Matteo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/matteo/32/75_2.png) [@Matteo](https://community.forestadmin.com/u/Matteo)
#### Post date: [June 7, 2020, 9:38pm UTC](https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426/1 "2020-06-07T21:38:54Z")

</div>

## Expected behavior

I’m embedding Forest Admin into my existing project, based upon Express and Sequelize.  
I have a Sequelize model.  
The sequelize model has some fields.  
One of the fields is declared as an `INTEGER` Sequelize type.  
When I create a new record for this model in Forest Admin and I input a nember (eg: `0`) in the form field related to the `INTEGER` field, the `typeof` of the value is supposed to be `number`.

## Actual behavior

The `typeof` of the value is `string`.

## Failure Logs

This is the relevant part of my model:

```javascript

// ...

testField: {
  type: DataTypes.INTEGER,
  field: 'test_field',
  allowNull: false,
  defaultValue: 0,
  validate: {
    justTest(value) {
      console.log('this is the value type:', typeof value)     
    },
  },
},     

// ...

```

In our integration test we do:

```javascript
// ...
await TestModel.create({
  // ...
  testField: 100,
  // ...
})
// ...

```

And this is what we see in the logs:

```nohighlight
this is the value type: number

```

But when I create the new record from Forest Admin, this is what I see in my logs:

```nohighlight
this is the value type: string

```

## Context

Package versions quoted from my `package.json`:

- Package Version: `"forest-express-sequelize": "^6.1.4"`
- Express Version: `"express": "~4.17.1"`
- Sequelize Version: `"sequelize": "^5.21.9"`
- Database Dialect: Sequelize
- Database Version: `postgres (PostgreSQL) 12.2`
- Project Name: Sailsquare

### EDIT

I updated the dependency versions list to correct a copy’n’paste typo in Sequelize version 😇

---

<div class="post-metadata">

### Author: ![anon37102731](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@anon37102731](https://community.forestadmin.com/u/anon37102731)
#### Post date: [June 8, 2020, 8:24am UTC](https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426/2 "2020-06-08T08:24:26Z")

</div>

Hi @Matteo,

Thank you for sharing your issue with the ForestAdmin community!

I’ve been able to reproduce your issue and I’ll dig this up to found the reason of it.

---

<div class="post-metadata">

### Author: ![Matteo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/matteo/32/75_2.png) [@Matteo](https://community.forestadmin.com/u/Matteo)
#### Post date: [June 8, 2020, 11:33am UTC](https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426/3 "2020-06-08T11:33:46Z")

</div>

Hi @anon37102731  
Thank you in advance! 🙂

Matteo

---

<div class="post-metadata">

### Author: ![anon37102731](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@anon37102731](https://community.forestadmin.com/u/anon37102731)
#### Post date: [June 9, 2020, 7:33am UTC](https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426/4 "2020-06-09T07:33:29Z")

</div>

Hi @Matteo,

A fix should have been released this morning!

Feel free to reach out if you find any other other issues.

---

<div class="post-metadata">

### Author: ![Matteo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/matteo/32/75_2.png) [@Matteo](https://community.forestadmin.com/u/Matteo)
#### Post date: [June 10, 2020, 8:16am UTC](https://community.forestadmin.com/t/sequelize-integer-field-value-passed-from-forest-as-a-string/426/5 "2020-06-10T08:16:29Z")

</div>

Hi @anon37102731.  
Now everithing looks fine and the very same check returns the expected type. The log now says `this is the value type: number`.

Yesterday a also noticed that there was a problem with frontend validations: if I entered a string in an `INTEGER` field, the _html_ input became red-bordered, but the form submitted without errors. As far as Ii can see, now the expected behavior is restored.

![Screenshot 2020-06-10 at 10.06.24](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/1X/045796ccebf6dda757fd8943aa9cf301a246fe97.png)

 ![Screenshot 2020-06-10 at 10.06.41](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/1X/cab53bf3df63cc9db354139128d37f8dfb5a720c.png)

👍

Thank you!
