Expand my Community achievements bar.

How do I use switch and case statements to fill more than one other field?

Avatar

Level 3

Hi all,

I'm new to the community.

I'm trying to make an existing form more user friendly for my coworkers. I want to use a switch and case approach in a drop-down list field so that the selection fills two seperate other fields with different info related to the selection.

I can already do this with one field, but if I add a second target field under an existing case the text doesn't appear there when I make the selection from the dropdown.

Basically, I'm asking if I can do this:

switch

(sNewSel)

{

   case "1": // Selection 1

    Row2.Field1

= "text for field 1";

    Row1.Field2 = "text for field 2";

    break;

etc.

It works if the "row1.field2" option isn't there, but not when it is present.

Any takers?

4 Replies

Avatar

Level 3

The formatting got messed up when posting. Pretend that it looks normal.

I attached an rtf file that gives you the basic idea.

Avatar

Level 6

Hi,

Actually it sholud work. maybe there is some problem on the form. If you post it i'll have a look.

BR,

Paul Butenko

Avatar

Level 3

I'm not sure if I will be able to send you the form. There may be too much to redact.

Would this last bit of code in the cell affect anything?

if

(bEnableTextField)

{

Row2.Field1.access

= "open"; // enable field

Row2.Field1.caption.font.fill.color.value

= "0,0,0"; // set caption to black

}

That is, do I also need to repeat the same thing for the second target cell (Row1.Field2)?

What would be possible hang ups that would prevent it from working correctly?

Dave

By the way, I'm not sure if my other attachment posted. I am trying again.

Avatar

Level 3

I was able to get it to work. For whatever reason, I had to add one more level in the description to get the second field to populate automatically.

So, I could say

  case "1":

    Row2.Column2 = "First text"

    Section1.Row1.Column3 = "Score value I want to display" // this was the part where I had to add Section1. Not sure why the first line didn't matter.

    break;

Thanks for taking a look.

Dave