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

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

Recommended Posts

Posted

Hi all,

I'm stuck with this validation script, triggered from a set of global fields for a new entry in my Master Company/Contact db.

This would be an updated version of "My check dupes and messages" (see Sample section), where a set of error messages (not the ShowMessage nor plug-ins) B)

- are appearing when the user clicks the proceed button and there are problems (first alert)

- are changing at the fly on screen when the user fills back the necessary fields after the first alert.

There are currently 4 results to the error messages calc :

calc =1 : some fields are missing

calc =2 : there is one dupe

calc =3 : there is more than one dupe

calc =4 : No problem

I've added the visibility trick, that is set with a 1, and a container for a backgound is also set with a 1.

The major part of the script works fine but when the exit scripts are triggered, the Pause is Active and the user is locked there (the Status Area is hided).

There are no Pause in the Validation and Go to Layout scripts.

Here is the script :

Allow user Abort (No)

Set error capture (Yes)

Set Field (g_background,1)

Set Field (g_visibilityControl,1)

Toggle Status Area (hide)

If (c_errormessages = 4)

----Perform script (Validation*)

End If

If (c_errormessages = 1)

----Bip

----Loop

--------Exit Loop If (c_errormessages # 1)

--------Pause/Resume (00:00:02)

----End Loop

----If (c_errormessages = 4)

--------Perform script (Validation*)

----End If

----If (c_errormessages = 2)

--------Perform script "Layout Checkdupes"

----End If

----If (c_errormessages = 3)

-------Perform script "Layout Checkdupes"

----End If

End If

If (c_errormessages = 2)

----Perform script "Layout Checkdupes"

End If

If (c_errormessages = 3)

----Perform script "Layout Checkdupes"

End If

I'm having problem with the bold part of the script.

What I want is the following.

If the user clicks the proceed button and the Name field is empty ( c_message = 1) a message "Please fill the Name" appears on screen...

The user can still work on the fields and then :

1. If the c_errormessages changed to 4 (=no problem), I want the script to trigger the Validation script that will create a new record and set the fields using the globals.

2. If the c_errormessages still is = 1 (there are other empty fields), the message is updated ("Fill in the field Category" for instance)

3. I the c_errormessages changed to 2 or 3 (there are dupes), the user is sent to a new layout with a portal to see the duplicates...

There may also be an easier construction of "If/End If " (I'm not experienced with If/End If,...) but I'm mainly focussed on the result part of the script.

In addition (but I would be glad to have solved the Major problem at first), as I wanted the message to disappear when the user was filling the fields, reappearing when the "Proceed button" was clicked, I tried using a global field g_currentFieldName and an exitscript set when g_currentFieldName # c_currentFieldName (Status(CurrentFieldName-unsorted) but no success with this...

Thanx.

Posted

Hi,

Sorry I identified the bug BUT CANNOT SOLVE IT for the moment.

The fact is that the category field is filled by a script (toggle A, B, C, D).

Then, this leads to another question B)

That was the part concerned :

If (c_errormessages = 1)

----Bip

----Loop

--------Exit Loop If (c_errormessages # 1)

--------Pause/Resume (00:00:02)

----End Loop

----If (c_errormessages = 4)

--------Perform script (Validation*)

----End If

----If (c_errormessages = 2)

--------Perform script "Layout Checkdupes"

----End If

----If (c_errormessages = 3)

-------Perform script "Layout Checkdupes"

----End If

End If

So during the loop, the fields may be corrected and one field is triggered by a script. So the scripts run OK as long as the field are filled with a classic method, but when involving a new script, it stops/resume the first one.

How can we do that ?

Posted

I prefer a simpler approach, dividing the procedure in 3 scripts:

A Start scripts brings the user to the data entry layout, clears global field, and puts the user in an endless loop (Loop/Pause/Loop) so that the only way out is to use one of the buttons

In this layout a <Cancel> button brings you back leaving things un changed

The <Submit> button performs the validation and does stuff if validation is passed

NOTE: both buttons are formatted to Halt current script in order to break the endless loop

As far as validation is concerned a basic validation cycle is

If (IsEmpty(globalfield))

Beep

Message You must fill field xxx

Perform Script (Locking script, the one that calls the endless loop)

Go to field (globalfield)

Exit script

EndIf

If (not IsEmpty(SelfJoin to check for duplicates::RecordID))

Beep

Message There is already a record with these data

Perform Script (Locking script, the one that calls the endless loop)

Exit script

EndIf

I find separate script more flexible and easier to debug ...

Posted

Thank you Giuseppe,

The shoemaker's kids go barefoot...!! grin.gif

I usually split my scripts in 2 or 3 parts also, and I've often recommanded this one on the Forum.

Well, as I said, I'm not that experienced in scripting and wasn't aware that a Halt script could stop "another" script to run.

Well, I just added a Halt Script at end of the Toggle Script, and it did it.

Thanks again for reading this long post.

This topic is 7898 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.