• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

@dialog Issue

Here my code for a action button

@DialogBox( "Disc" ; [AutoHorzFit] : [AutoVertFit] ; "Editing Approval Work Flow" );
@SetField("Manager1"; discManager);
@SetField("ManagerA"; DiscManagerB);
@SetField("ManagerB"; DiscManagerC);
@SetField("ManagerC"; DiscManagerD);
@Command([RefreshHideFormulas] )

The problem is if the user hits cancel, all the manager fields on the form become null, works correctly if OK is hit
0
Jaziar
Asked:
Jaziar
  • 3
  • 3
  • 2
2 Solutions
 
marilyngCommented:
Add a response:

response := @Dialogbox(....);
@if(response = "";@Return(@Prompt([OK];"Nothing selected";"You need to select something"));"");
Then set your fields as you need to...

The @Return(""), will stop the code, and the Response will return the value selected.
0
 
Sjef BosmanGroupware ConsultantCommented:
I seem to remember it was more like @True and @False:

    @If(@DialogBox(....); ...; ...)
0
 
JaziarAuthor Commented:
Could you explain a little better sjef
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Sjef BosmanGroupware ConsultantCommented:
Marilyn's code assumes that the return value from @DialogBox is a string value. AFAIK, @DialogBox returns @True (OK clicked) or @False (Cancel clicked)
0
 
JaziarAuthor Commented:
response := @DialogBox( "Disc" ; [AutoHorzFit] : [AutoVertFit] ; "Editing Approval Work Flow" );
@if(response = @False;@Prompt([Ok];"Nothing selected";"You need to select something");"");
@SetField("Manager1"; discManager);
@SetField("ManagerA"; DiscManagerB);
@SetField("ManagerB"; DiscManagerC);
@SetField("ManagerC"; DiscManagerD);
@Command([RefreshHideFormulas] )

Now it says "you need to select something" and still deletes the values on my main form .  If they hit cancel I want the box to close and not change any of the fields on the main form.
0
 
Sjef BosmanGroupware ConsultantCommented:
You missed the @Return in Marilyn's code.

@if(response = @False;@Return(@Prompt([Ok];"Nothing selected";"You need to select something"));"");
0
 
JaziarAuthor Commented:
You are correct
0
 
marilyngCommented:
Thanks, sjef for the catch, I was concentrating on the @Return, and somehow had " @Prompt([OKCANCELLIST])..." in my head, rather than a dialog box.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now