DataShapes ListView Inconsitency

Hello Everyone,


I am trying to create a UI for nested data using Data-Shapes. Please see below graph. The data shapes package UI looks good but when I check the user input data, I see some not selected values as well.
Could someone please help me?

Thanks in adavnce!

You’ll have to explain what your data structure looks like, what your inputs were in the UI, and what you were expecting. Right now we have no clue what it is you actually did or want.

image
My Data structure is very simple, it is just in text format.
Title 1 - Two options
Title 2 - Two options

I am also attaching the UI image that data-shape pops-up. which is what I am looking for!
But when I select those values. the “User Inputs” has extra values which i did not pick.

You need to provide an input for test2. If you include the Select all / Select none option, then you must pick one of them if no individual options are selected.

If that still doesn’t fix the issue then try providing each ListView Input separately to make sure they are working as intended.

Thank you for helping me out on this. But somehow I am not able to re-create that. I did select “select none” for test2. but I still got wrong value.
were you able to do this?

My intention was to create a “flexible” ListView form so that depending on upstream data, form would change. I would prefer not to hard code ListView input separately.


if you want your values to be seperate choises you need to list them as seperate chocies.
if you want test one input to select apple & banan and test 2 input for Pear & pinapple
you need to do as picture below

Sorry, it’s been a while since I’ve used Data-Shapes and I totally forgot that this change occurred.

The python code that makes up the input nodes from Data-Shapes no longer supports multiple inputs for the same node. You would have to use two Listview Data nodes for your two input lists or pull out the python code from the node and modify it to handle multiple input lists.

If you know how many inputs lists you’ll have (but need to keep the selections or length flexible), then multiple nodes is a no-brainer. If you need full flexibility in the number of potential selections, then you’ll need to deal with the python code or find an alternative solution.

No I would like to have flexibility to pick individual fruit from the options. for example, Apple and Mango Only in your example.

I tried your list structure as well but I am not able to get to the desired result.

@Mostafa_El_Ayoubi Could you please help me with this?

I don’t think it is the ListView node that needs any modification, it is the MultipleInputForm++ Python code that shows value currently but selection is not output correctly as shown. somewhere here.

That’s true, but as I said, it works with two separate ListView nodes. That would seem to point to the MultipleInputForm working fine with multiple inputs (which makes sense since that’s literally the point of the node).


The ListView output is what determines the keys and values which seem to be the problem area.

2 Likes

the first picture i posted does just that you need the all the (values as seperate entities see first picture)

works on my end its not working for you?

Are you sure? It’s still returning only values from the first list for me. It seems highly unlikely that an issue with maintaining multiple inputs would be fixed by flattening the list structure.


I made some edits in ListView Data Node to work with nested list. It is working fine for me. Could you please check if you can replicate the results?

#Copyright (c) mostafa el ayoubi ,  2016
#Data-Shapes www.data-shapes.net , elayoubi.mostafa@gmail.com
#edited to work with nested list

class listview():

    def __init__(self,inputname,height,highlight,display_mode,element_count,default_values,sorted,showId):
        self.inputname = inputname
        self.height = height
        self.highlight = highlight
        self.display_mode = display_mode
        self.element_count = element_count
        self.default_values = default_values
        self.sorted = sorted
        self.showId = showId

    def __setitem__(self, key, item):
        self.__dict__[key] = item

    def __getitem__(self, key):
        return self.__dict__[key]

    def __iter__(self):
        return iter(self.__dict__)

    def values(self):
        return self.__dict__.values()

    def keys(self):
        return self.__dict__.keys()

    def __repr__(self):
       return 'UI.ListView input'
		#return listview
if isinstance(IN[0],list):
	in0 = IN[0]
else:
	in0 = [IN[0]]

if isinstance(IN[1],list):
	in1 = IN[1]
else:
	in1 = [IN[1]]

if isinstance(IN[2],list):
	in2 = IN[2]
else:
	in2 = [IN[2]]

if IN[6]:
	element_count = len(in1)
else:
	element_count = 0

#x = listview(IN[0],IN[3],IN[4],IN[5],element_count,IN[7],IN[8],IN[9])

compiled=[]
for i in range(len(IN[0])):
	x = listview(IN[0][i],IN[3],IN[4],IN[5],element_count,IN[7],IN[8],IN[9])
	for k,v in zip(in1[i],in2[i]):
		if x.showId :
			try:
				try:
					x[str(k)+ '  -  id: ' + str(v.Id)] = v
				except:
					x[k.encode('utf-8').decode('utf-8') + '  -  id: ' + str(v.Id)] = v
			except:
				try:
					x[str(k)] = v
				except:
					x[k.encode('utf-8').decode('utf-8')] = v
		else:
			try:
				try:
					x[str(k)] = v
				except:
					x[k.encode('utf-8').decode('utf-8')] = v
			except:
				try:
					x[str(k)] = v
				except:
					x[k.encode('utf-8').decode('utf-8')] = v
	compiled.append(x)
OUT = compiled

If it’s working for you that’s all that matters. I would recommend you don’t modify the original node (make a copy) or, better yet, make it work with just the python node.

1 Like

nope my mistake.

Not even when working after putting all inputs to @L1 or @L2?

Correct.