How to take the values from DAT to CHOP

Hi,
I am using panel execute inside a button and trying to some continuous values between 0.1 and 1. I want to export these values to a constant chop. For that I stored the x values in var1. When I tried to use this expression me.parent().fetch(‘var1’) inside constant CHOP (which is inside the button) its only taking the last value ie, 1, all other values are not showing. I also used an examine DAT to know the values. In that also only one value is showing ie, 1. But when i print inside textport all values between 0.1 and 1 is showing up.
Any solution to get all the values out of DAT?
Thanks in advance

def whileOn(panelValue):
x = .1
while x<1:
x = x+.01
me.parent().store(‘var1’,x)
print(me.parent().fetch(‘var1’))
return

The problem you encounter is that the expressionCHOP does not know that there is a new value in var1, and because of that it does not recalculate the expression. There are several ways to go about this:

  • Create another ConstantCHOP in your button and, instead of setting var1, set the parameter. You can now refference the parameter or the corrosponding channel in your target constantCHOP, or simply use a selectCHOP.
  • Use python to create a so called dependable. Contrary to a Var, a parameter can subscribe to a dependable, and get a “notification” when you change the value, triggering the Parameter/OP to recalculate the expression.
    Dependency Class - Derivative
1 Like

Thanks alot, Will try it

I didn’t use and expressionCHOP instead i used a constantCHOP to fetch the value of var1 from the DAT python script.
Being a beginner, the first option is not clear for me . If you can show me some screenshots it will be really helpful

Thanks

Hi @arunrajan, I’m not 100% sure i understood your question, but generally speaking to go from dat to chop you can try to use a “dat to” chop.
add a “DAT to” CHOP into your network, then just drag and drop your dat table onto the “DAT to” CHOP.
I hope that helps!