# why '.setDataProviderValue(dataProviderID, value)'?

**URL:** <https://forum.servoy.com/t/why-setdataprovidervalue-dataproviderid-value/9035>\
**Category:** Classic Servoy\
**Created:** [April 23, 2008, 9:25am UTC](https://forum.servoy.com/t/why-setdataprovidervalue-dataproviderid-value/9035 "2008-04-23T09:25:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgs](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tgs](https://forum.servoy.com/u/tgs)\
**Post date:** [April 23, 2008, 9:25am UTC](https://forum.servoy.com/t/why-setdataprovidervalue-dataproviderid-value/9035/1 "2008-04-23T09:25:46Z")

</div>

Hello all!

What is the difference in setting a value to a dataprovider by:

name = ‘Mr. Bean’;  
respectively  
controller.setDataProviderValue(‘name’, ‘Mr. Bean’); ??

Regards, Thomas

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [April 23, 2008, 9:42am UTC](https://forum.servoy.com/t/why-setdataprovidervalue-dataproviderid-value/9035/2 "2008-04-23T09:42:32Z")

</div>

The effect is the same.

You can use the second when you are working with a generic script, attached to different fields where you want to do some processing, checking etc.

It was very handy in the pre 3.5 ages, maybe not so important nowadays since we have validators etc.

the use can be ```  
forms[formName].controller.setDataProviderValue(fieldName, value);

```auto

Where formName and fieldName come from lasttriggered blabla ...
```

---

<div class="post-metadata">

**Author:** ![tgs](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tgs](https://forum.servoy.com/u/tgs)\
**Post date:** [April 23, 2008, 9:58am UTC](https://forum.servoy.com/t/why-setdataprovidervalue-dataproviderid-value/9035/3 "2008-04-23T09:58:04Z")

</div>

Thank you Marcel!

I think it will be a good choice to take

```auto
forms[formName].controller.setDataProviderValue(fieldName, value);

```

in my global methodes, or?

Thomas

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [April 23, 2008, 10:04am UTC](https://forum.servoy.com/t/why-setdataprovidervalue-dataproviderid-value/9035/4 "2008-04-23T10:04:12Z")

</div>

> tgs:  
> Thank you Marcel!
> 
> I think it will be a good choice to take
> 
> ```auto
> forms[formName].controller.setDataProviderValue(fieldName, value);
> 
> ```
> 
> in my global methodes, or?
> 
> Thomas

Hard to tell.  
I used it once or twice but not much to be quite honest.
