Can i show a form with "CONFIRM"???

FranklinFranklin Member Posts: 253
I make it show a form to accept a CONFIRM?

If I can not do that, you think of a similar option?

:-k :-k :-k

Regards...

Comments

  • SavatageSavatage Member Posts: 7,142
    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.
  • klavinklavin Member Posts: 117
    Franklin wrote:
    I make it show a form to accept a CONFIRM?

    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."
  • kinekine Member Posts: 12,562
    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...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • FranklinFranklin Member Posts: 253
    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.
  • SaalekSaalek Member Posts: 181
    Hi

    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.
  • FranklinFranklin Member Posts: 253
    edited 2009-12-11
    Thx Saalek.

    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.
  • SaalekSaalek Member Posts: 181
    What error ??

    Try using setrecord.
  • FranklinFranklin Member Posts: 253
    The typical error...

    errorh.th.png

    If you want i show you the message in english...

    I think i can´t show a new form like this.
  • kapamaroukapamarou Member Posts: 1,152
    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.
  • SaalekSaalek Member Posts: 181
    Hi

    I'm Spanish, so I Understud the message :mrgreen::mrgreen:

    I'll send you a PM

    Bye
  • FranklinFranklin Member Posts: 253
    Perfect.

    The problem was RUNMODAL. I have to use RUN instead of RUNMODAL.

    Thx everybody.

    =D>
  • kinekine Member Posts: 12,562
    Saalek wrote:
    Hi

    I'm Spanish, so I Understud the message :mrgreen::mrgreen:

    I'll send you a PM

    Bye

    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
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SaalekSaalek Member Posts: 181
    kine wrote:
    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:
    :mrgreen::mrgreen:
  • kapamaroukapamarou Member Posts: 1,152
    Franklin wrote:
    Perfect.

    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 ...." ).

    Just review it thoroughly. :D
Sign In or Register to comment.