In a form create with the form wizard. Witch code is automat

csimoneauxcsimoneaux Member Posts: 168
In a form create with the form wizard. Witch code is automatically generated ?

A: Validate(“No.”) in onaftergetrecord
B: SETRANGE(“No.”) in onaftergetrecord
C: FORM.Save() in onDeleterecord()
D: ???? in onNewRecord


I can not find answer to this question anywhere.
Please help [-o<

Comments

  • DenSterDenSter Member Posts: 8,307
    Why don't you create a form with the wizard (takes 5 seconds) and take a look at those triggers.
  • kuloicatkuloicat Member Posts: 9
    I also don't know the answer
    I do create a card form with form wizard and it donesn't generate any code for the form by default.

    the question is actually to ask what standard code you should write rather than automatically generate from form wizard.
  • csimoneauxcsimoneaux Member Posts: 168
    I have and there is nothing there. I am not that lazy.
  • DenSterDenSter Member Posts: 8,307
    All standard Navision Card forms have SETRANGE("No.") programmed in their OnAfterGetRecord trigger.
  • csimoneauxcsimoneaux Member Posts: 168
    Thank you.Thank you. Thank you. \:D/
    I have read so many books and could not find this any where.
    Where did you find this answer?
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I've learned this at solution developer training, years ago.

    I don't remember reading it anywhere.

    As far as I know it is only at master data tables like customers, vendors and items.

    It is not on the sales order card /production order card etc.
  • DenSterDenSter Member Posts: 8,307
    I knew the answer because of experience, but at some point in my career I looked around for things like that. I didn't read it anywhere, I just opened a card form in the designer and opened the code window. Then I opened another Card form and saw the same SETRANGE. So I opened another, and another, and another, and figured out that this is in all standard Navision Card forms.

    Most of these answers are right in the application, all you need to do is look around for them. What prompted me to search around was a customer that wasn't able to keep a filter on the No field, and that's how I discovered this particular thing. With this question I would have done the same thing, I would have opened a card form to take a look around. The only one in there is number B. Then I'd have opened 10 more Card forms just to make sure.

    The best way to learn these things is not to try to find it in any book, but by trying it yourself. Create a new database just for yourself and screw around in it as much as you want.
  • PassHopePassHope Member Posts: 25
    Hello.

    I've also tried to make card forms without luck to generate the code.
    I also tried the Customer database as source table.

    If you open the code in other card forms like form 21 Customer Card then you se SETRANGE("No.") in the OnAfterGetRecord.

    But in the Dev II Training Manual from MSBS it says this in designing a Card form :

    Solution: Enter the following code in the Form - OnAfterGetRecord trigger:
    SETRANGE("No.");


    Why insert a code witch should be automatic inserted?

    In several places I have seen VALIDATE("No.") as the right answere...

    I don't see this code either, but could it be a code witch is not possible to remove? I am confused. I exported one form as txt, but could not see the code there either. Until I hear another thing, I might think SETRANGE("No.") is correct since it has been said i in solution training.

    Another Question :

    46) you are posting a journal. What are dimensions that are used?
    a) journal
    b) ledger
    c) default

    Is it A?
  • PassHopePassHope Member Posts: 25
    Just wanted to answere my own question.

    Opened the Jnl.-PostLine codeunit, and it uses the Journal Line Dimension record.

    I am still in doubt over the automatic added code.
    Validate("No.") is used to call the OnValidate trigger of the field, so this seems to be wrong.
    It seems like an trick question. Also a bit frustated that they could ask this question in exam.
  • DenSterDenSter Member Posts: 8,307
    Well that is a common exam strategy in multiple choice questions. Only one answer can be right, so they have to give you 3 answers that are NOT right.
  • PassHopePassHope Member Posts: 25
    I see your point if there were an right answere, but I'm not convinced it is. As I said earlier, in the Dev II course book we were told to MANUALY enter this code.
    Maybee this was a fact in earlier versions. In my Navision no code is automatically generated.

    It is a tricky question if no answere is correct, though.

    It might be the right answere for the exam, but not in the real world.
    I would be thankful if you could get this blur away from my brain and convince me this also happeneds in ver 4.0.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    No automatic code

    Never has been.
  • DenSterDenSter Member Posts: 8,307
    There is no automatic code in any form wizard as far as I know. I think that csimoneaux didn't remember the question correctly. If that's not the case, then there is a bug in the exam ;). I wouldn't know, since they didn't allow me to write anything down at my exam, so there's no way for me to know for sure.

    Anyway, the purpose of this forum is to learn, and by now you should know everything there is to know about what the form wizard does, so any question about that topic should be easy for you now :).
  • write2souravwrite2sourav Member Posts: 113
    I think the answer is Validate("No.")
Sign In or Register to comment.