Expand my Community achievements bar.

SOLVED

New to FormCalc, Complex If/Then?

Avatar

Level 2

Hello all,

I'm completely new to FormCalc (having plenty of Excel and Filemaker Pro formulaic experience) and am working on a form with a relatively simple function:

(I.) Drop-down list of 24 unique items

(II.) Each of those items correlates to one of 10 options

(III.) The user needs to select one of the 24 unique items and the appropriate correlated item needs to autofill in a series of fields.

ABCDEFGHIJKLMNOPQRSTUVWX
001222223334455666788999

I have the FormCalc guide open and can follow the if/then/elseif syntax and daisy chain the above, but before I do that I want to ask: "Is there a more simple and elegant way?"

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

you can also use bound items for this purpose.

1. Activate them in the binding tab

2. change the value for each element to the one which should be displayed later in the fields (same values for several elements are possible).

3. use this script in the change:Event of the dropdown box:

View solution in original post

7 Replies

Avatar

Correct answer by
Level 10

Hi,

you can also use bound items for this purpose.

1. Activate them in the binding tab

2. change the value for each element to the one which should be displayed later in the fields (same values for several elements are possible).

3. use this script in the change:Event of the dropdown box:

Avatar

Level 2

Simple and elegant!

Thanks, radzmar!

Avatar

Level 2

Follow-up question: Would you happen to know how to expand the tool window so that the entirety of the Value and Text columns are visible?

The Object Library tool window expands and adapts, but Object, Accessibility, Border, Layout and all their sub-tabs stay the same size regardless.

Avatar

Level 2

Hmm... I may have spoken too soon.

Upon further testing, selecting "E" from the drop-down list returns a value of "2" as it should. However, selecting "H" (which also corresponds with "2") bounces the option back to "E". In other words, "H" cannot be selected or, if it is being selected, it is being being reverted to the earliest option in the list with the same value. This happens with all similar cases.

Avatar

Level 2

I've done a bunch of research on this now and I don't think the original solution can work. Here's what I've done and let me know if I misunderstood instructions:

The Dropdown

  1. Create Dropdown List/Field with options A through X as mentioned in the first post. (Field name: LockList)
  2. Click on dropdown list/field, go to Object/Binding, click on Specify Item Values
  3. Change Values of text options (A-X) to their corresponding 0-9 values (see first post)
  4. Problem: Many of the options (A-X) share the same values (0-9). If I select an option "H", it will automatically revert to "E", the first in order with the same value "2".
  5. Problem: I don't understand what this is supposed to do -- > LockList.rawValue = $.boundItem(xfa.event.newText)


The other fields

  1. Create Text Field (Field name: TEST)
  2. Calculate: TEST.rawValue=LockList.rawValue
  3. This part works. It shows the listed Value for the selected option in the dropdown.

Avatar

Level 10

Oh,

I see what's the problem.

Ok, you can ship around this when you add an extra space to every bound item which is present twice or more.

BoundItems_XMLSource.png

Avatar

Level 2

Ah! That just may work. I'll try it later and check back in.