Jump to content
Developer Wiki and Function Reference Links ×

Dynamic Popup Node with Worksheet


Gregi

Recommended Posts

Hello everybody

 

I would like to create a "dynamic" Popup Node, which uses Content of a Worksheet.

It works pretty good, but its not refreshing the Popup-List in the OIP, but the output content is the correct one.

So i guess I have to delete the cache of the node or something like that. Is there a way to do so?

 

The Script in the Node:

#gim 2020-11-20
@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
	tabname = 'Spot Standard' #Name der Tabelle
	tab = vs.GetObject(tabname) #Handle zur Tabelle
	(numRows, numColumns) = vs.GetWSRowColumnCount(tab) #Zählt die Anzahl Zeilen und Spalten
		
	def frange(x, y, jump): #x entspricht der Startzeile in der Tabelle, y der letzten Zeile, jump ist die Schrittgrösse
		while x - y <= .000001:
			yield x
			x += jump

	list = []
	list = [n for n in frange(2, numRows, 1)] #erstellt eine Liste, welche Zeilen aus der Tabelle ausgewählt werden sollen
		
	Artikelbeschriebe = []
	Artikelnummern = []
	for i in range(len(list)):
		Artikelbeschriebe.append(vs.GetWSCellFormulaN(tab, list[i], 1)) #Die Beschriebe sind in der ersten Spalte
		Artikelnummern.append(vs.GetWSCellFormulaN(tab, list[i], 2)) #Die Nummern sind in der zweiten Spalte

	#Name
	this = Marionette.Node( 'Popup' )	
	this.SetDescription('Zeigt ein PopUp mit den Werten aus der Tabelle "Spot Standard" und gibt Name und Artikelnummer weiter')
	
	#Input Ports
		
	#OIP Controls
	input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, Artikelbeschriebe)
	input.SetDescription('Die Auswahl aus der Tabelle "Spot Standard", Spalte 1')
	
	#Output Ports
	outputs = Marionette.PortOut('sArtikel')
	outputs.SetDescription('Artikelbeschrieb')
	outputn = Marionette.PortOut('nArtikel')
	outputn.SetDescription('Artikelnummer')
	
#BEHAVIOR

def RunNode(self):
	#inputs
	input = self.Params.input.value #Integer der Auswahl
	Artb = self.Params.Artikelbeschriebe
	Artn = self.Params.Artikelnummern
	
	
	#script
	outputs = Artb[input]
	outputn = Artn[input]
	
	#Aktualisierung der Wertetabelle
	tabname = 'Spot Standard' #Name der Tabelle
	tab = vs.GetObject(tabname) #Handle zur Tabelle
	(numRows, numColumns) = vs.GetWSRowColumnCount(tab) #Zählt die Anzahl Zeilen und Spalten
		
	def frange(x, y, jump): #x entspricht der Startzeile in der Tabelle, y der letzten Zeile, jump ist die Schrittgrösse
		while x - y <= .000001:
			yield x
			x += jump

	list = []
	list = [n for n in frange(2, numRows, 1)] #erstellt eine Liste, welche Zeilen aus der Tabelle ausgewählt werden sollen
		
	Artikelbeschriebe = []
	Artikelnummern = []
	for i in range(len(list)):
		Artikelbeschriebe.append(vs.GetWSCellFormulaN(tab, list[i], 1)) #Die Beschriebe sind in der ersten Spalte
		Artikelnummern.append(vs.GetWSCellFormulaN(tab, list[i], 2)) #Die Nummern sind in der zweiten Spalte
	
	#outputs
	self.Params.input.value = Artikelbeschriebe
	self.Params.outputs.value = outputs
	self.Params.outputn.value = outputn

 

Popup mit Werten aus Tabelle_2020-11-21.vwx

  • Like 1
Link to comment
  • 1 month later...
  • 2 weeks later...
  • Marionette Maven

OIP controls are not dynamic and there isn't a smooth way to do this at the moment. It's something I've been looking into for a couple of years now, I have some ideas in progress to get around the limitation, but they aren't completely set yet. I'll try to remember to update once I get things nailed down better.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...