# How get a complete bool values from DB with Double Words?

**URL:** <https://discourse.nodered.org/t/how-get-a-complete-bool-values-from-db-with-double-words/38202>\
**Category:** Industrial\
**Created:** [29 December 2020 12:54 UTC](https://discourse.nodered.org/t/how-get-a-complete-bool-values-from-db-with-double-words/38202 "2020-12-29T12:54:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jotarod](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jotarod](https://discourse.nodered.org/u/Jotarod)\
**Post date:** [29 December 2020 12:54 UTC](https://discourse.nodered.org/t/how-get-a-complete-bool-values-from-db-with-double-words/38202/1 "2020-12-29T12:54:45Z")

</div>

Dear colleagues,

I a have a DB with alarms that looks something more or less like this :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/f/5fe91a029f4280915e0edc92348bb1678ed6a2a6.png)

Imagine that would like to get the values until the direction 99.7 . Of course, introduce one to one the dbx directions in the contrib.s7 node is a tedious task... so:  
There is a methor to extract with node red the complete values of the complete db and then split it?  
I was thinking in use DBD instead of each DBX but I dont know how can I get the values of the bit once I have the DBD value...

Any ideas about this?  
Many thanks!!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [29 December 2020 13:38 UTC](https://discourse.nodered.org/t/how-get-a-complete-bool-values-from-db-with-double-words/38202/2 "2020-12-29T13:38:35Z")

</div>

You can use buffer-parser node to get all your bools in one go. An additional bonus side-effect is reading 1 numeric is much faster and efficient than reading multiple bools.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c4c61b316abddb0e8381929900b7eb0d460d0cce.png)

```auto
[{"id":"30f0e139.daa44e","type":"buffer-parser","z":"766a1068.58afb","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"16bitbe","name":"bits","offset":0,"length":2,"offsetbit":0,"scale":"1","mask":""},{"type":"bool","name":"bools","offset":0,"length":32,"offsetbit":0,"scale":"1","mask":""},{"type":"bool","name":"bit0","offset":0,"length":0,"offsetbit":0,"scale":"1","mask":""},{"type":"bool","name":"bit1","offset":0,"length":1,"offsetbit":1,"scale":"1","mask":""},{"type":"bool","name":"bit2","offset":0,"length":1,"offsetbit":2,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":1690,"y":100,"wires":[["84033c6c.93fad"]]},{"id":"90adea38.cc6ff8","type":"inject","z":"766a1068.58afb","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1680,"y":60,"wires":[["c6e5e1f1.c7876"]]},{"id":"c6e5e1f1.c7876","type":"function","z":"766a1068.58afb","name":"fake PLC data","func":"msg.payload = Buffer.from([\n 0xf0, 0x0f, 0x99, 0x66\n])\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1840,"y":60,"wires":[["30f0e139.daa44e"]]},{"id":"84033c6c.93fad","type":"debug","z":"766a1068.58afb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1870,"y":100,"wires":[]}]

```

The Buffer parser accepts either a 16bit integer array or byte buffer as input.

---

<div class="post-metadata">

**Author:** ![Jotarod](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jotarod](https://discourse.nodered.org/u/Jotarod)\
**Post date:** [29 December 2020 13:53 UTC](https://discourse.nodered.org/t/how-get-a-complete-bool-values-from-db-with-double-words/38202/3 "2020-12-29T13:53:29Z")

</div>

I going to test today, I will give you my feedback.  
Many Thanks!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 February 2021 13:53 UTC](https://discourse.nodered.org/t/how-get-a-complete-bool-values-from-db-with-double-words/38202/4 "2021-02-27T13:53:32Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
