# Function to decrypt Base64 data from Node-Red and display on dashboard

**URL:** <https://discourse.nodered.org/t/function-to-decrypt-base64-data-from-node-red-and-display-on-dashboard/14941>\
**Category:** General\
**Created:** [30 August 2019 12:40 UTC](https://discourse.nodered.org/t/function-to-decrypt-base64-data-from-node-red-and-display-on-dashboard/14941 "2019-08-30T12:40:25Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [3 September 2019 12:54 UTC](https://discourse.nodered.org/t/function-to-decrypt-base64-data-from-node-red-and-display-on-dashboard/14941/21 "2019-09-03T12:54:38Z")

</div>

> [@cherechi](#):
>
> separate the numbers based on the comma between them

this

> **[String.prototype.split() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)**
>
> The split() method of String values takes a pattern and divides this string into an ordered list of substrings by searching for the pattern, puts these substrings into an array, and returns the array.

then

> **[String.prototype.trim() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)**
>
> The trim() method of String values removes whitespace from both ends of this string and returns a new string, without modifying the original string.

to get rid of the surrounding whitespace

---

<div class="post-metadata">

**Author:** ![cherechi](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@cherechi](https://discourse.nodered.org/u/cherechi)\
**Post date:** [3 September 2019 13:27 UTC](https://discourse.nodered.org/t/function-to-decrypt-base64-data-from-node-red-and-display-on-dashboard/14941/22 "2019-09-03T13:27:47Z")

</div>

Thanks all, i so appreciate your guidance all through. this project has taken me 3 months and in just a week following all your follow ups am close to finish. please one last problem i have is that after i split the values which were supposed to be current and Voltage i wrote a function in order to connect to the gauges. the function is as in photo 2 while my splitted values are shown in photo 1. now when i connected the guages, i only have readings on the voltage gauge and nothing on the current gauge. i guess i have a mistake in the function code. please if you can help. my gauges are in photo3 ![data2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f65f0a85e798e29e0aa2336e1051a515fbbbda05.png) ![data3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/64c61e29961f1b3f2a6a6a3d72f79b4d724ae237.png)

 ![data4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/be97d2312c160e73a99e91f46ba5d5db801d4dd3.png)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [3 September 2019 13:39 UTC](https://discourse.nodered.org/t/function-to-decrypt-base64-data-from-node-red-and-display-on-dashboard/14941/23 "2019-09-03T13:39:02Z")

</div>

Read the section on logging events [https://nodered.org/docs/user-guide/writing-functions](https://nodered.org/docs/user-guide/writing-functions)

Then you can add lines in your function node to see what’s going on.

[Previous page](https://discourse.nodered.org/t/function-to-decrypt-base64-data-from-node-red-and-display-on-dashboard/14941.md?page=1)
