# Reducing a complexity of the flow

**URL:** <https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508>\
**Category:** General\
**Created:** [11 January 2023 03:57 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508 "2023-01-11T03:57:09Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 January 2023 12:38 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/21 "2023-01-11T12:38:49Z")

</div>

So can you post your (complete) incoming data, the flow you currently have and a screen capture of the dashboard as it currently is?

I appreciate that this is a commercial system, you might need to falsify the data to an extent

---

<div class="post-metadata">

**Author:** ![Jhankhana](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jhankhana](https://discourse.nodered.org/u/Jhankhana)\
**Post date:** [11 January 2023 12:47 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/22 "2023-01-11T12:47:34Z")

</div>

I am attaching the SS of flow, dashboard as it currently, flow and debug panel...

 ![Screenshot (160)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfc0ced6f6a9968d0008fdb90de3c565143aa0db.png)  
 ![Screenshot (162)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/ef80f16fbdccbc5b69b174fd4e0b8e7915fa1669.png)  
[flows (16).json](https://discourse.nodered.org/uploads/short-url/y4GOwZJxCWkrUr56aB7mATgo157.json) (20.8 KB)

[{"Agg1\_Current\_Weight":210.6,"Agg1\_Set\_Weight":200,"Agg2\_Current\_Weight":210.6,"Agg2\_Set\_Weight":210,"Agg3\_Current\_Weight":246.59998,"Agg3\_Set\_Weight":220,"Agg4\_Current\_Weight":241.20001,"Agg4\_Set\_Weight":270,"Bitumen\_Current\_Weight":80.46,"Bitumen\_Set\_Weight":50,"Filler\_Current\_Weight":0,"Filler\_Set\_Weight":50,"\_time":"2023-01-11T12:42:34.989Z"}]

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 January 2023 13:18 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/23 "2023-01-11T13:18:06Z")

</div>

> [@Jhankhana](#):
>
> Also  
> what and Where I should write to round up to 2 decimal point.(00.00)?

To address just the rounding issue for your table, not whether your code is the best style, nor the issue of whitespace for Agg2, the function which constructs the table can be tweeked like this:

 ![Untitled 5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/715ecf04d777599c9c3ba160086ff5f80c45509a.jpeg)

```auto
[
    {
        "id": "0eed20f323d53d9d",
        "type": "function",
        "z": "8b63e60d25961a51",
        "name": "",
        "func": "\n msg.payload = [\n {\n \"Name\": \"Agg1\", \n \"Last Batch\": msg.payload[0].Agg1_Current_Weight,\n \"Archived Recipe(%)\": Math.round(msg.payload[0].Agg1_Current_percentage * 100) / 100,\n \"Targeted Recipe(%)\": Math.round(msg.payload[0].Agg1_Set_percentage * 100) / 100,\n \"Error in Recipe(%)\": Math.round(msg.payload[0].Agg1_Error * 100) / 100\n },\n {\n \"Name\": \"Agg2\",\n \"Last Batch\": msg.payload[0].Agg2_Current_Weight,\n \"Archived Recipe (%)\": Math.round(msg.payload[0].Agg2_Current_percentage * 100) / 100,\n \"Targeted Recipe (%)\": Math.round(msg.payload[0].Agg2_Set_percentage * 100) / 100,\n \"Error in Recipe (%)\": Math.round(msg.payload[0].Agg2_Error * 100) / 100\n },\n {\n \"Name\": \"Agg3\", \n \"Last Batch\": msg.payload[0].Agg3_Current_Weight,\n \"Archived Recipe(%)\": Math.round(msg.payload[0].Agg3_Current_percentage * 100) / 100,\n \"Targeted Recipe(%)\": Math.round(msg.payload[0].Agg3_Set_percentage * 100) / 100,\n \"Error in Recipe(%)\": Math.round(msg.payload[0].Agg3_Error * 100) / 100\n },\n {\n \"Name\": \"Agg4\", \n \"Last Batch\": msg.payload[0].Agg4_Current_Weight,\n \"Archived Recipe(%)\": Math.round(msg.payload[0].Agg4_Current_percentage * 100) / 100,\n \"Targeted Recipe(%)\": Math.round(msg.payload[0].Agg4_Set_percentage * 100) / 100,\n \"Error in Recipe(%)\": Math.round(msg.payload[0].Agg4_Error * 100) / 100\n }\n ];\n return msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 700,
        "y": 740,
        "wires": [
            [
                "6d4f394963cfbff8",
                "017b681410e0cb83"
            ]
        ]
    }
]

```

ps this is rounded to the _nearest_ 0.01 not rounded _up_ to 2dp. Do you really need to round up?  
I think Math.ceil() rounds up. Not sure how it works with the negative numbers though.

pps Do you see the same missing values on the Agg2 line? This might be a problem in my setup.

---

<div class="post-metadata">

**Author:** ![Jhankhana](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jhankhana](https://discourse.nodered.org/u/Jhankhana)\
**Post date:** [12 January 2023 04:28 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/24 "2023-01-12T04:28:49Z")

</div>

Thank you so much for your king help!  
Edit  
It's working in my case.

I have seen that missing value. It's problem in my set up. I am trying to find out it.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 January 2023 04:32 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/25 "2023-01-12T04:32:03Z")

</div>

Specify a size for your widget rather than "Auto"

---

<div class="post-metadata">

**Author:** ![Jhankhana](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jhankhana](https://discourse.nodered.org/u/Jhankhana)\
**Post date:** [12 January 2023 04:37 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/26 "2023-01-12T04:37:25Z")

</div>

Yes,  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![Jhankhana](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jhankhana](https://discourse.nodered.org/u/Jhankhana)\
**Post date:** [12 January 2023 04:41 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/27 "2023-01-12T04:41:27Z")

</div>

> [@Jhankhana](#):
>
> Edit:  
> I am unable to get Bitumen\_Current\_percentage,Bitumen\_Set\_percentage, Bitumen\_Error, Filler\_Current\_percentage,Filler\_Set\_percentage, Filler\_Error

Please Help me to get this Bitumen and Filler thing

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 January 2023 05:20 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/28 "2023-01-12T05:20:47Z")

</div>

> [@Jhankhana](#):
>
> Please Help me to get this Bitumen and Filler thing

what is the calculation ?

---

<div class="post-metadata">

**Author:** ![Jhankhana](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jhankhana](https://discourse.nodered.org/u/Jhankhana)\
**Post date:** [12 January 2023 05:34 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/29 "2023-01-12T05:34:58Z")

</div>

do your mean what's the current situation by conclusion?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 January 2023 05:36 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/30 "2023-01-12T05:36:34Z")

</div>

> [@Jhankhana](#):
>
> Bitumen\_Current\_percentage,Bitumen\_Set\_percentage, Bitumen\_Error, Filler\_Current\_percentage,Filler\_Set\_percentage, Filler\_Error

How are the calculations done for these values ?

---

<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:** [13 March 2023 05:43 UTC](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508/32 "2023-03-13T05:43:50Z")

</div>

Closed on 13 March 2023 05:43 UTC

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

[Previous page](https://discourse.nodered.org/t/reducing-a-complexity-of-the-flow/73508.md?page=1)
