# Dataset tag and or bar chart obj

**URL:** <https://forum.inductiveautomation.com/t/dataset-tag-and-or-bar-chart-obj/23535>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [March 22, 2019, 3:11pm UTC](https://forum.inductiveautomation.com/t/dataset-tag-and-or-bar-chart-obj/23535 "2019-03-22T15:11:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.inductiveautomation.com/u/claudio)\
**Post date:** [March 22, 2019, 3:11pm UTC](https://forum.inductiveautomation.com/t/dataset-tag-and-or-bar-chart-obj/23535/1 "2019-03-22T15:11:16Z")

</div>

Hello  
I would use a bar chart component to shoiw two bars: TargetPieces (which is an OPC tag already present in my gateway) and ProducedPieces (which is an OPC tag already present in my gateway)

How can I do that? Should I build an expression dataset tag and bind it to the graphical obj? In this case how can I do that?

Many thanks  
C.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 23, 2019, 2:55pm UTC](https://forum.inductiveautomation.com/t/dataset-tag-and-or-bar-chart-obj/23535/2 "2019-03-23T14:55:21Z")

</div>

I would use [objectScript()](https://www.automation-pros.com/simaids/doc/expression.objectscript.html) (part of [Simulation Aids](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-simulation-aids)) to do it in a simple expression:

```auto
objectScript("system.dataset.toDataSet(['Pieces'],[[x] for x in args])",
  {TargetPieces}, {ProducedPieces})

```

You can do this with runScript, too, if you encapsulate the logic above in a project script function.

---

<div class="post-metadata">

**Author:** ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.inductiveautomation.com/u/claudio)\
**Post date:** [March 23, 2019, 9:45pm UTC](https://forum.inductiveautomation.com/t/dataset-tag-and-or-bar-chart-obj/23535/3 "2019-03-23T21:45:04Z")

</div>

thank you  
I defined a shared script

def composeDS(\*args):   
rows = []  
oneRow = [“Pz”, args[0], args[1]]  
rows.append(oneRow)

```
headers = ["Pz", "Target", "Act"]
data = system.dataset.toDataSet(headers, rows)	
return data	

```

then an expression dataset tag in which the expression is a call to the previous function  
runScript(“shared.project.composeDS”,0,{[.]targetPcs},{[.]actPcs})

and I attached this tag to my bar chart obj … perfect!  
thank you for your help
