Retrieving a cell value from a grid using a variable for the

Posted by MBeynon on 07-Mar-2013 04:14

Hi

I was just curious as to why in my code the following works:

lvcFormatValue = lvrRow:Cells["UOMFieldMask"]:Value:toString().

but this does not:


lvcFormatValue = lvrRow:Cells[lvcFieldMask]:Value:toString().

Has anyone else encountered this? Is there any way around it?

Thanks Mark.

P.S. I tried the following but that gave me the same linked chain attributes error:

lvcFormatValue = lvrRow:Cells[QUOTER(lvcFieldMask)]:Value:toString().

All Replies

Posted by Admin on 07-Mar-2013 04:17

but this does not:

can you be a bit more precise on the "does not" work?

Posted by MBeynon on 07-Mar-2013 04:21

Sure, I get this error:

Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)

Posted by Admin on 07-Mar-2013 04:26

The most common case would be that the variable lvcFieldMaske does not contain the value "UOMFieldMask".

The QUOTER should be wrong here.

Another case might be, that the Value of the Cell returns the unknown value. UNBOX is usually preferable then :ToString().

What does VALID-OBJECT (lcrRow:Cells[lvcFieldMask]) retrun?

Posted by MBeynon on 07-Mar-2013 04:50

The variable lvcFieldMask does contain the value "UOMFieldMask" as proved by my debugs.

The line below returns blank in my debug so I'm a bit puzzled! :


VALID-OBJECT(lvrRow:Cells[TRIM(lvcFormatMask)])


---------------------------
Message (Press HELP to view stack trace)
---------------------------
captions:  Moved Qty
field:  Moved Qty
lvcFormatMask:   UOMFieldMask
valid obj: 
---------------------------
OK   Help  
---------------------------

Posted by Admin on 07-Mar-2013 04:56

The line below returns blank in my debug so I'm a bit puzzled! :

Then you need to ensure that lvrRow is a valid reference.

Posted by MBeynon on 14-Mar-2013 04:09

I eventually identified the problem as an unprintable character in the variable, hence the problem!

This thread is closed