What are you trying to do? Do you want to enter data into that form and have a confirm statement show up?
Something like. "Are you sure you want to change X to Y?" Yes/No?
Note: adding an "Are you sure" type of staement really should be added to the Onvalidate of that field in the table. That way if this field is accessed from any other form the confirm is still always asked.
If I can not do that, you think of a similar option?
:-k :-k :-k
Regards...
From online help (Help > C/SIDE Reference Guide):
CONFIRM (Dialog)
Use this function to create a dialog box which prompts the user for a yes or no answer. The system centers the dialog box on the screen for you.
Ok := Dialog.CONFIRM(String [, Default] [, Value1] ,...)
Ok
Data type: boolean
This return parameter reflects the user's selection.
Ok will be...
If you entered...
TRUE
Yes
FALSE
No
String
Data type: code or text constant
The system displays this string in the dialog box. Use a back slash (\) to indicate a new line. The string can be a multilanguage enabled text constant.
Default
Data type: boolean
Describes what the computer should use as the default button. If you do not specify a default, the system uses No.
Comments
The system sizes the message window for you. The height of the window corresponds to the number of lines and the width corresponds to the length of the longest line.
Examples
In the following example, the Dialog.CONFIRM function prompts the user for a Yes or No answer:
Question := Text000;
Answer := Dialog.CONFIRM(Question, TRUE);
MESSAGE(Text001, Answer);
Create the following text constants in the C/AL Globals window:
Text Constant
ENU Value
Text000
'Leave without saving changes?'
Text001
'You selected %1.'
-Lavin "Profanity is the one language all programmers know best."
But before you use CONFIRM, please, do not forget that CONFIRM will pause the transaction if it is already started,thus keeping locks on tables/records etc. Inproper usage of confirm inside transaction can kill server performance. Each time use CONFIRM as soon as possible, before write transaction is started...
Well. What I do is the following. When you register a purchase order, NAV creates the sales order (under conditions). The sales order has a price.
NAV, the price tells you that you are applying (with a message). If you want to continue nothing happens, but otherwise you should show the sales order.
I had never done anything like this, but if you can not make it look otherwise.
.....
If not Confirm('The price is %1. Continue',salesprice) then
begin
clear(OrderForm);
TSalesHeader.get(........);
OrderForm.settableview(TsalesHeader);
OrderForm.runmodal;
end;
....
My question is. What would you like to do with the opened form ????
This error (I guess) means that a transaction has started. In that case you cannot do a runmodal because it will lock the resources until a user reaction, which is not allowed.
If your "logical" transaction has finished you must call COMMIT before the runmodal in order to release the resources.
Other wise make sure that you haven't called a Modify or Insert before your call.
I do not need to understand Spanish to know what's going on. If the error message in NAV have more than 4 lines, it is about running write transaction when calling RUNMODAL... :-D
I do not need to understand Spanish to know what's going on. If the error message in NAV have more than 4 lines, it is about running write transaction when calling RUNMODAL... :-D
- SQL Sync. errors, have more than 4 lines, and aren't caused by a RUNMODAL :whistle: :whistle:
The problem was RUNMODAL. I have to use RUN instead of RUNMODAL.
Thx everybody.
=D>
I think that if you use RUN instead of RUNMODAL in your code then your FORM will show up but the code after the RUN will be executed immediately. Depending on what follows (and what precedes) your RUN it might lead to problems (if a modify occurs you might see the famous "Another user has modified ...." ).
Comments
Something like. "Are you sure you want to change X to Y?" Yes/No?
Note: adding an "Are you sure" type of staement really should be added to the Onvalidate of that field in the table. That way if this field is accessed from any other form the confirm is still always asked.
http://www.BiloBeauty.com
http://www.autismspeaks.org
From online help (Help > C/SIDE Reference Guide):
"Profanity is the one language all programmers know best."
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
NAV, the price tells you that you are applying (with a message). If you want to continue nothing happens, but otherwise you should show the sales order.
I had never done anything like this, but if you can not make it look otherwise.
If I understud correctly, you can do that.
.....
If not Confirm('The price is %1. Continue',salesprice) then
begin
clear(OrderForm);
TSalesHeader.get(........);
OrderForm.settableview(TsalesHeader);
OrderForm.runmodal;
end;
....
My question is. What would you like to do with the opened form ????
Bye.
I want to show the Sales Order Form filtered by the new document generated.
I have the same error in the code.
CLEAR(PurchaseOrderForm);
TSalesHeader.SETFILTER("Document Type",'%1',1);
TSalesHeader.SETRANGE("No.",vNumDoc);
SalesOrderForm.SETTABLEVIEW(TSalesHeader);
SalesOrderForm.RUNMODAL;
If i use TSalesHeader.GET it fails too.
Try using setrecord.
If you want i show you the message in english...
I think i can´t show a new form like this.
If your "logical" transaction has finished you must call COMMIT before the runmodal in order to release the resources.
Other wise make sure that you haven't called a Modify or Insert before your call.
I'm Spanish, so I Understud the message
I'll send you a PM
Bye
The problem was RUNMODAL. I have to use RUN instead of RUNMODAL.
Thx everybody.
=D>
I do not need to understand Spanish to know what's going on. If the error message in NAV have more than 4 lines, it is about running write transaction when calling RUNMODAL... :-D
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
- SQL Sync. errors, have more than 4 lines, and aren't caused by a RUNMODAL :whistle: :whistle:
I think that if you use RUN instead of RUNMODAL in your code then your FORM will show up but the code after the RUN will be executed immediately. Depending on what follows (and what precedes) your RUN it might lead to problems (if a modify occurs you might see the famous "Another user has modified ...." ).
Just review it thoroughly.