Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6288 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.,

Posted

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

Posted

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

This topic is 6288 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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