how to get null in the drop down value

时间:2015-05-12 22:30:41

标签: java save

I have 2 drop downs with unequal lengths. I am passing the values of each dropdown to the controller and from there after doing some operations I am saving the same to the database.

I have a query as If the first dropdown has 4 entries and second dropdown has 7 entries then the last 3 entries of first dropdown passed to the controller should be null. how can I achieve it.

I have tried with some code but its not working.

from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class SomeClass(Base):
    __tablename__ = 'some_table'
    id = Column(Integer, primary_key=True)
    name =  Column(String(50))

1 个答案:

答案 0 :(得分:0)

If

sum(!is.na(x))

then for

firstDropdownNames.length == 7 and secondDropdownNames == 4

j will always be 3, therefore

int j= firstDropdownNames.length - secondDropdownNames.length;

will only be true when i == 3. What you probably want instead of i==j is:

i==j

(assuming secondDropdownNames.length is shorter otherwise use firstDropdownNames.length)

Also, what are the types of firstDropdownNames and secondDropdownNames. It looks like they are arrays. If so, then you have to be careful because if secondDropdownNames.length == 4 and you try secondDropDownNames[i] = null when i>= 4, then you will get an illegal argument exception because you are trying to set a value outside of the array bounds.