Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Add a Condition to the script

Featured Replies

Hi, I have a following script and I would like to add a condition to it so that it will check if one or both search fields are empty. Cannot figure out how to add that to it.

Set Error Capture [On]

Go to Field [select/perform; Global_fields::Product_Create_Search_Criteria]

Set Field [Global_Fields::Product_Create_Search_Criteria; Inventory::Item_ID]

Go to Field [select/perform; Global_Fields::Product_Create_Vendor_Name]

Set Field [Global_Fields::Product_Create_Vendor_Name; Inventory::Vendor_ID]

Go to Layout ["Product" (Product)]

Adjust Window [Resize to Fit]

Go to Record/Request/Page [First]

Enter Find Mode []

Set Field [Product::Item_ID; Global_Fields::Product_Create_Search_Criteria]

Set Field [Product::Item_Vendor_ID; Global_Fields::Product_Create_Vendor_Name]

Perform Find []

Set Field [Global_Fields::Get_Last_Error; Get(LastError)]

If [Global_Fields::Get_Last_Error <> 0]

Show Custom Dialog [Title: "Product Verification"; Message: "No Product found for this item. Proceed with the creation of the product?"; Buttons:"OK","Cancel"]

  If [Get(LastMessageChoice)=1]

Show All Records

Go to Record/Request/Page [Last]

New Record/Request

Set Field [Product::Item_ID; Global_Fields::Product_Create_Search_Criteria]

Set Field [Product::Item_Vendor_ID; Global_Fields::Product_Create_Vendor_Name]

Commit Records/Requests [No dialog]

Go to Layout [original layout]

  Else If [Get(LastMessageChoice) = 2]

Go to Layout [original layout]

  End If

End If

If [Global_Fields::Get_Last_Error = 0]

Show Custom Dialog [Title:"Product Verification";Message:"This item already has a product associated with it"; Buttons:"OK"]

Go to Layout [original layout]

End If

Set Field [Global_Fields::Product_Create_Search_Criteria; ""]

Set Field [Global_Fields::Product_Create_Vendor_Name; ""]

Adjust Window [Resize to Fit]

I think that I should change this:

If [Global_Fields::Get_Last_Error <> 0]

Just do not know how to say If one of the search fields is empty.

Reason being that if someone forgets to enter info when creating a new inventory item and then tries to create a product and to prevent accidental creation of a empty product if someone click accidentally on "Create Product" button before actually entering any information into the new item record.

Thank you.,

If I understand your question, you want to check whether the field is empty before you even enter Find mode. You'd use steps like this:

If[ IsEmpty( search field) ]

  // administer cattle prod

  Halt script

 End If

will check if one or both search fields are empty

Count ( SearchFieldA; SearchFieldB) < 2

...but underneath the def. frame is a checkbox; should be lifted - not as default, saying: Evaluate even if all referenced

fields are empty!!!

--sd

  • Author

Thank you.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.