7 Replies Latest reply on Oct 2, 2015 12:41 PM by Tom_Droz

# Seta  Field to = another fields value, using by variable?

Is there a way to set a fields value so that it equals another fields value by using a variable?

If I have field 1, 2, 3 and 4, with 1 being a calculation, can I set that field to equal 2, 3, or 4 by a based on a scripted variable?

Thanks!

Tom

• ###### 1. Re: Seta  Field to = another fields value, using by variable?

Yes you can. But you must use a global variable (\$\$)

Field 1 (Calculation) = \$\$Value

Script:

If [Condition 1]

Set Variable [ \$\$Value ; field 2 ]

Else If [Condition 2]

Set Variable [ \$\$Value ; field 3 ]

Else

Set Variable [ \$\$Value ; field 4 ]

End If

Hope this helps

• ###### 2. Re: Seta  Field to = another fields value, using by variable?

It sounds like your calculation for field 1 is conditional based on a value.  You want to put that value in a variable but I would put it in another field.

Having said that, it would be helpful to have more information.  What are fields 1-4? What is your variable? What is the calc for field 1?

• ###### 3. Re: Seta  Field to = another fields value, using by variable?

I'm sorry I wasn't as clear as I could have been.

What I want to can be done without a variable by Field1=Field2, but what if later I wanted it to be Field3 or Field4?   The question is can that be done with a variable and a script step?

When the variable is passed to field 1 I want it to equal what ever is in the selected counter field across all records.

so if I passed in some variable representing field 2, record 1 would equal what ever Field2 has on each record

• ###### 4. Re: Seta  Field to = another fields value, using by variable?

Nehme

That works on a record by record basis, but that is not what Im trying to do,  I am looking for a variable that can be expressed now in the field definition as Field1=Field2  or Field1=Field3.  But instead of a constant, is there a way to pass a variable that would bring the same results?

I attempted to pass the field name or the TO::Field Name but was unable to get that to work

• ###### 5. Re: Seta  Field to = another fields value, using by variable?

The calculation could be

GetField ( fieldReference ), i.e. GetField ( \$\$fieldReference )

then use a script (step) with

Set Variable [ \$\$fieldReference ; AFullyQualifiedFieldName ]

How you get that FQN in there is the other question …

Tom_Droz wrote:

I'm sorry I wasn't as clear as I could have been.

You would be even clearer if you avoided abstract field names and described the actual scenario …

• ###### 6. Re: Seta  Field to = another fields value, using by variable?

Sorry for not understanding a lot your purpose.

But can't you set all this in the calculation:

Field 1 ( calculation ):

Case (

condition 1 ; filed 2 ;

condition 2 ; field 3 ;

field 4 )

?

• ###### 7. Re: Seta  Field to = another fields value, using by variable?

Nehm

Thank you for insisting lol

Yes that does work!  I am trying to sort a portal on a popover.   I am passing that information to a field which then the portal is sorted on.  Works beautify!