Data entry form to reappear in the existing process

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Data entry form to reappear in the existing process

Post by jsira2003@yahoo.com »

I have a form that I want to re-appear after the data entry is complete. The only way
I can make it seemless if it is a recursive call. I do not want to start a new
process. I want the form to work in the existing process and not create a new process.
Is there a way to do this?


FormX{
}

Button_ok{
code
code
code
Show-FormX_psf
}

thanks,
John
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Data entry form to reappear in the existing process

Post by mxtrinidad »

You don't need to show the form again. One option would be to have $global:variable to allow the changes values to reappear in the main form. This way every time you click on the button, the values will be updated.

You can do a quick test by having a textbox (set as readonly) with a default value "My Text Here!", at the button event add one line of have the code:

$textbox1.Text = "TextChange - " + $global:cnt++;

So, every time you click the button, the form textbox will be updated with a different value.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: Data entry form to reappear in the existing process

Post by jsira2003@yahoo.com »

When the user clicks on the ok button the form goes away. I don't see how this will prevent the form from going away? Also all of the fields need to be re-initialized next pass. If there is a way to repeat the data entry screen I guess I can re-initialize the variables. The Show statement makes the form reappear. With what you specified I see the screen disappear after the user click ok.

thanks,
John
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: Data entry form to reappear in the existing process

Post by jsira2003@yahoo.com »

Perhaps that is my issue using the ok button instead of a different button that doesn't terminate the form. I assume my issue is the ok button that it ends the form where as another button will still be in the form. Am I understanding this correctly? Is there a way to change the behavior of the ok button not to terminate the form?

thanks,
John
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Data entry form to reappear in the existing process

Post by mxtrinidad »

I can only assume that somewhere in your code that in button event is causing the close of the form.

For example, the following code is in my test blank form:
1. I added a textbox, then under Properties "Behavior" change to be: "MultilLine=True" and "ReadOnly=True".
2. The code behind under the Script pane:

Code: Select all

$form1_Load={
	#TODO: Initialize Form Controls here
	$global:cnt = 0;
}

$button1_Click={
	#TODO: Place custom script here
	$textbox1.Text = "TextChange - Incremental = " + $global:cnt++;
}
3. Save the form and run.

You'll notice that, when you click on the button, it will refresh the form updating the Textbox without exiting the form.
It's also possible that the code may be crashing the form making it to exit without any errors.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: Data entry form to reappear in the existing process

Post by jsira2003@yahoo.com »

I changed my dialogresult to none instead of OK and this prevented the form from going away. Now all I have to do is reinitialize my variables in the button control for the next pass. This worked as I hoped.

Thanks!
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Data entry form to reappear in the existing process

Post by mxtrinidad »

Awesome! Let us know if there's anything else we can assist.

Thanks and Happy Thanksgiving!
This topic is 6 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.