0

List Box ADDList

I have come across and issue where listbox lbADDList function is removing portions I have listed to enter into the listbox. Example:

(@ATT_STEPS = "1,2,4,4" from an earlier portion of the procedure.)

  5.017  MATH         att_steps = lbNew("Select Attenuator steps")
  5.018  MATH         lbText(att_steps,"Select Attenuator Steps")
  5.019  MATH         lbAddList(att_steps,@ATT_STEPS)
  5.020  MATH         lbConf(att_steps, "+multi")
  5.021  MATH         lbShow(att_steps)
  5.022  MATH         ATT_STEPS = lbSelCount(att_steps)

When the listbox comes up, it will only display 

1

2

4

It cuts off the additional 4, one could only assume it is because it is repetative. In this case I need that second 4 in there. Anyone know how to force it to display repetative entries? 

4 comments

Date Votes
0
Avatar
James Smith
The website does not like my copy and paste.
 
MATH         att_steps = lbNew("Select Attenuator steps")
MATH         lbText(att_steps,"Select Attenuator Steps")
MATH         lbText(att_steps,"Multiple choice is accepted")
MATH         lbAddList(att_steps,@ATT_STEPS)
MATH         lbConf(att_steps, "+multi")
MATH         lbShow(att_steps)
MATH         ATT_STEPS = lbSelCount(att_steps)
0
Avatar
Reiner Kuhnle

Hi James,

you can use the second '4' with a placeholder '_' preassign and then overwrite.

1.001 MATH @ATT_STEPS = "1,2,4,_"

1.002 MATH att_steps = lbNew("Select Attenuator steps")

1.003 MATH lbText(att_steps,"Select Attenuator Steps")

1.004 MATH lbAddList(att_steps,@ATT_STEPS)

1.005 MATH lbConf(att_steps, "+multi")

1.006 MATH lbRepl(att_steps,"_","4")

1.007 MATH lbShow(att_steps)

1.008 MATH ATT_STEPS = lbSelCount(att_steps)

 

0
Avatar
James Smith

That helps. I can find a work around using that. The variable is actually populated from a file and it will not be the same everytime. I appreciate it. 

0
Avatar
James Smith

MetCal has some sort of special rule that is really bad. If a value is a repeat of the same value within a string, the first instance and the numbered instance are treated the same being that the first instance takes the effect without consideration of the numbered instance. For example #1 see above. For example #2 see below. This is really weird and really bad

 

math @A = "1,2,3,4,4,4,4,5,6"

math @S = FINDI(@A,",",0)

math CTR = 0

do

math CTR = CTR + 1

math CTRR = CTR + 4

math @B = REPL(FLD@A,CTRR,",","I",@A)

until CTR == @S

Everytime you cycle through it will always replace the first instance of 4 and not the actual numbered field. Then when you get to the digit beyond the 4 it canges them all back to 4 and then goes on normal. MetCal has a really strange hangup with repeating numbers. I know it throws a math error at the end. This is just a random example of the behavior in MetCal

Please sign in to leave a comment.