Form and Subfrom - Options greying out.

nvermanverma Member Posts: 396
I have a form called Purchase Quote. Within the form I have a subfrom. Form gets it data from Purchase Header table and subfrom gets it data from Purchase Line table.

The subform contains following fields: TYPE (option: G/L Entry, Fixed Assets, Item, Charge), Cost Center Code (Code 20), No. (code 20).

So basically, if the No. Field in the form begins with RF******, I need the Type ---> G/L Entry, Item and Charge greyed out and Fixed Asset to be automatically selected (in the subform).

I am not sure How to do this. The form and subform are linked by the No. Fields.

Answers

  • SavatageSavatage Member Posts: 7,142
    When you say the "No." field are you refering to the Purch Line "No." Or the Header "No."

    You do realize Purchase Quotes is standard Nav. You make it sound like it's some creation you made?

    Are you trying to mimic it in your own "new form"?

    Have you ever seen options "Grayed Out" in Nav?

    This is something you have to add to the code on the Purchase line table on validate of the "No.".
    to perhaps show an error message if a certain type isn't being used.

    If you look at the code you will see how it handles different TYPE's.
    This almost sounds like your going the route of hardcoding "RF" stuff.
    Hardcoding is never a good idea. Try to rethink the solution.

    Just because it's needed today doesn't mean it will be needed down the road.
    Just train the users to do it correctly.

    Here's a perfect example:
    viewtopic.php?f=23&t=52376
    he had to find in the code somewhere where "2" was used. Probably what they wanted at some point but things change and any changes you make should be accessible in a setup table somewhere incase the need changes in the future.
  • Big_DBig_D Member Posts: 207
    Hi nverma

    On your subform you could have

    Form - OnAfterGetCurrRecord()
    IF "No." = 'RF******' then
    CurrForm.Type.editable (false)
    else
    CurrForm.Type.editable (True);
    CurrForm.UPDATECONTROLS;

    and on your Purchase Line table

    No. - OnValidate()
    if "No." = 'RF******' then
    Type := Type::"Fixed Asset";

    Good luck
    Big D signing off!
  • nvermanverma Member Posts: 396
    Thanks that was very helpful. I figured out a way of doing this.

    :)
  • Big_DBig_D Member Posts: 207
    Your welcome nverma always aim to please \:D/ !

    Until next time
    Big D signing off!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    <Edit> who cares its not my customer getting the bad solution.</edit>
    David Singleton
  • nvermanverma Member Posts: 396
    It is what the customer wanted. They have created a No. Series (which starts with RF) that will keep track of No.

    That's is how they want to differentiate between there records. Thats what I will give them because thats what my manager wanted.
  • Big_DBig_D Member Posts: 207
    Good on you nverma - your right the Customer is always King =D> !

    Until next time
    Big D signing off!
Sign In or Register to comment.