Help Center>Studio v11 (Foundation)

Add If conditions

For greater control over the data that gets posted to SAP, you can add If conditions to a field or fields. Every field in the If condition is checked against the condition and is processed only if it meets the condition.

Studio v11 supports two levels in a condition.

Add a condition

  1. On the Map tab, select the fields you want to apply the condition to.
  2. Click Create Condition.

    create if condition button on map tab

    If Create Condition is grayed out, click the Expert View tab.

  3. In the If Condition box, choose the operand.

    drop down menu

    Notes:
    If you choose First Transaction or Not First Transaction, click OK or click Add New Group to add more conditions.

    If your script was recorded in GUI Scripting mode, you will also see the Index Field option.

  4. Based on the operand that you chose, do one of the following:
    • Click the SAP field.
    • Click the column letter or cell number, and then click Go.
  5. Choose an operator, such as Greater Than.

    Note:
    In Studio v11.x, the Between operator includes both of the specified values as well as the values between them.

    In Studio v11.2, the Between operator appears as >=*=< to represent that it is inclusive in Studio v11.x.

    The Between operator for Studio v10.x scripts that are run in Studio v11.2 appears separately as A > 2 and A < 3 to represent that it is not inclusive.

    Studio v11.2 converts the v10.x From-To operator to Between; v10.x will display the v11.x Between operator as From-To.

    Transaction with Foundation does not currently support linked dynamic list files that are used by the In List and Not In List operators.

  6. Do one of the following:
    • Type the value for the condition.

      Note: If the value contains decimal places or long text, be sure your data read preferences are set to As stored. Click the File tab, click Options, click Data, and then click As stored.

    • Check the Compare with Column box, choose the column letter or cell number that contains the value you want Transaction to compare, and then click Go.

      For example, you can select the column that contains Gross Weight, select the Is Greater Than operator, check the Compare with Column box, and select the column that contains Net Weight.

  7. To add another condition, click the plus sign.

    plus sign button

  8. To add a second level to the condition, click Add New Group (for example, IF ((A=1 & B=2) OR IF First Transaction), Then repeat steps 3-6.

    add new group button

Tip: In Studio v11.0.2, you can include log columns in conditions. If you have a loop that contains pop-up screens that appear for some records and not others, you can use a condition to evaluate the messages that were returned during validation and prevent those pop-up screens from stopping the upload.

If condition operands

First Transaction Use this operand when a screen or action is only required in the first record. This condition will not be applied to the second record and any subsequent records.

Not First Transaction Use this operand when a screen or action is only required on the second record and any subsequent records. This condition will not be applied to the first record.

Column Use this operand to specify whether a screen, field, or action should occur based on static values or values in your data file.

If you are using cell-based mapping, the operand is Cell.

SAP Field Use this operand when you need to validate data that is available in SAP as opposed to your data file. This condition will verify whether a specific field contains the correct value before executing what is in the condition.

Important:
Some fields appear on multiple screens, so you need to choose the specific instance of the field that you want to check.

The SAP Field operand is not available in Batch Input mode.

Index Field

The Index Field operand is available only for scripts that were recorded in GUI Scripting mode. Use Index Field with regular loops (NOT indexed loops) to search and update multiple rows based on one field’s value.

With Index Field, you can find a row based on a value in a given column.

Important: Index Field supports text values only.

  1. First, map only the fields that need to be updated.
  2. In the If Condition box, choose Index Field.
  3. If you want to update multiple rows based on the search field, check the Find All box.
  4. Select the SAP field that you want to search for. This field should not be mapped.
  5. Choose an operator.
  6. Enter the value that you are searching for, or click Compare with column and select the column.

If conditions in web services

You can use If conditions to create custom non-SAP fields and then use those fields to manage the forms.

  1. On the Expert View tab of the Mapper, select the rows that are included in the If condition, and then click Create Condition.

    Studio displays the Form Field operand and a list of custom fields.

  2. Choose the field that you want or type a new field name.

    Note: The first time that you add a condition, the list is blank. Type the name that you want, and it will stay in the list.

  3. Type the value that you want to use, or check the Compare with form field box to compare this field with a different custom form field.

To create a condition that is based on an SAP field, change the operand to SAP Field.

Change the condition

  • Click the condition statement to reopen the Condition box, and then make the changes that you want.

Delete the condition

  1. In the Mapper, click the row that contains the condition statement to select the row.
  2. Right-click the row, and then click Delete.