C/AL problem

iqbalmadiqbalmad Member Posts: 179
hello gurus,

can sm1 help me on this little problem:

these codes will be on the OnPush trigger of a menu button---

----
IF Table17.Application Type(custom created) of selected line = 2
GET Table 17.Entry No. of selected line and store in VAR4
Select from Table 50009(custom created) where Table 50009.Tab17 Entry No. = VAR4
For the selected record(s)
Open a new form and …
Display Table 17 Entry where Table 17.Entry No. = Table50009.Applied-to ID No.

thnkx guys

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    And what exactly is the problem? What does not work? What's the error? :?:
  • WaldoWaldo Member Posts: 3,412
    Do you want us the translate your pseudocode to C/AL??

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • iqbalmadiqbalmad Member Posts: 179
    hi Waldo..

    can you translate it to C/AL please..

    thnkx
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Some wise man said that it's better to teach people how to catch fish than to give them fish.

    So instead of translating it into C/AL I'd rather offer this instead: http://www.mibuso.com/dlinfo.asp?FileID=744

    This tutorial does not cover the form part. Some hints on it:

    If you got a record var for T17 called GenLedgEntry, you can show a filtered view on T17 on a form by:
    GenLedgEntry.SETRANGE(somefield, 'somevalue');
    FORM.RUN(0,GenLedgEntry);
    

    or if you want the user to choose a record:
    COMMIT;
    IF FORM.RUNMODAL(0,GenLedgEntry) = Action::LookUpOK THEN BEGIN
       MESSAGE(FORMAT(GenLedgEntry."Entry No."));
    END;
    
    [/code]
  • iqbalmadiqbalmad Member Posts: 179
    i already knew wat u told miklos...


    IF "Application Type" = 2 THEN
    BEGIN
    GLPAE.SETRANGE("Tab17 Entry No.","Entry No.");

    // my problem is that i dnt no how to sore
    // values that i have obtained from the previous setrange
    // and then take these "RAS Applied-to ID No.") to do my
    // next setrange

    GLEntry.SETRANGE("Entry No.",GLPAE."RAS Applied-to ID No.");
    FORM.RUN(FORM::"General Ledger Entries-Iq",GLEntry);
    END;


    thnkx
  • girish.joshigirish.joshi Member Posts: 407
    Use settableview on the form -- I think you can only do that if you have the form declared instead of calling it dynamically.

    Another approach, that only works in certain situations, is to add the selected records to temporary variable of the same type, and then call form.run (form::someform, tempvar)
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Some wise man said that it's better to teach people how to catch fish than to give them fish.

    Very wise indeed.

    Writing code for iqbalmad would be irresponsible since we would be putting another inexperienced programmer on the market.

    iqbalmad, write you code first, then post it here. We will GUIDE you to the right direction instead of just giving you the answer.
  • girish.joshigirish.joshi Member Posts: 407
    well, I just told him how to do it! I guess its too late, lizard :wink:

    anyway, everyone was inexperienced once, and he did write his own code.... mibuso is all about helping each other.

    man, when I think back to my early postings.... :shock:
  • Alex_ChowAlex_Chow Member Posts: 5,063
    well, I just told him how to do it! I guess its too late, lizard :wink:

    anyway, everyone was inexperienced once, and he did write his own code.... mibuso is all about helping each other.

    man, when I think back to my early postings.... :shock:

    He didn't exactly write his own code....
  • DenSterDenSter Member Posts: 8,307
    edited 2006-07-14
    well if you think that is code then I guess that says a lot about you doesn't it :mrgreen:

    <edit>For those of you that don't understand my sense of humor, this is a joke and not intended to hurt anyone's feelings</edit>
  • girish.joshigirish.joshi Member Posts: 407
    And comments like that say a lot about you :mrgreen:

    there were semi colons... some of the words were keywords... that's code... it just needs to be revised
  • DenSterDenSter Member Posts: 8,307
    edited 2006-07-14
    LOL funny people in here :lol:

    <edit> I was actually laughing out loud when I wrote this in response to the previous post, this is not a sarcastic remark</edit>
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    DenSter,

    please, try to understand that some people are in a less comfortable situation than you... and I not only mean experience, but the size of the team, the availability of help from other members of the team, wise business planning, planning the costs for trainings and so on... some people are in hard situation, like being thrown into a business consultancy right after the business school without any decent planning from their managers and therefore finding out at 80% of the project that some important changes are need to be done and as they have written 3 Excel macros now they are appointed as developers... I think being haughty just because you always had experienced, reasonable employers and managers is kind of short-sighted. I think we need to help, although, of course not doing the homework of others as in this case they would not learn from it. It' s a careful balance to strike. Giving enough for helping people move through obstacles, but withholding enough for leaving people to figure out things for themselves as only in this case does the experience really go deep and be remembered for long...
  • Alex_ChowAlex_Chow Member Posts: 5,063
    DenSter,

    please, try to understand that some people are in a less comfortable situation than you... and I not only mean experience, but the size of the team, the availability of help from other members of the team, wise business planning, planning the costs for trainings and so on... some people are in hard situation, like being thrown into a business consultancy right after the business school without any decent planning from their managers and therefore finding out at 80% of the project that some important changes are need to be done and as they have written 3 Excel macros now they are appointed as developers... I think being haughty just because you always had experienced, reasonable employers and managers is kind of short-sighted. I think we need to help, although, of course not doing the homework of others as in this case they would not learn from it. It' s a careful balance to strike. Giving enough for helping people move through obstacles, but withholding enough for leaving people to figure out things for themselves as only in this case does the experience really go deep and be remembered for long...

    I agree with you completely. Sometimes our experience get the best of ourselves, and this goes for every MVP, top posters, and everyone else experienced with Navision that posts in this forum.

    It's frustrating when you see postings where users do not even try to lookup the answers themselves. I understand they're put into tough situations, however, that's what they're paid to do.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    On the topic:

    iqbalmad,

    I am not exactly sure what you are tryin to achieve. It's like filtering for entries of some kind and the looking up the application entries for these entries?

    I think it would be a lot easier on a report than on a form: you can do all the filtering whithout any code, just by indentation and setting properties.

    Anyway, if you go to a Sales Order which has Reserved Quantity,, drill into Reserved Qty. and look at the form that runs there, or if you go to Item Card, Item Ledger Entries, and click on Application, both forms do something like that: they filter entries and then find entries applied, related to these entries. You can take the idea from there. But don't assume it to be easy, a report could be a lot better idea.

    Forms were mostly designed to show records from one table with simple filterings,, and while this rule can be bended and is bended in the standard system in the above example, it's the reports that were meant for more complex data modeling.
  • DenSterDenSter Member Posts: 8,307
    Miklos and Deadlizard...

    Your assertions about me being haughty and short sighted are out of line, and I'll leave it at that.

    What I personally do is answer direct questions, and sometimes I have time to elaborate a bit more. When appropriate, I point people to the right manual and even section of manuals, so they can look up the answer. I will not however do other people's analysis or research for them. As you can read from this thread I did not answer the original poster, not because I don't want to, but because I don't have time to do it.

    My joke (you can tell by the :mrgreen: that it was a joke) was directed at Girish, who I happen to know personally. The important part is that Girish understands (he got me right back :wink:), but I'll edit the post so it is crystal clear.

    I never mean to offend anyone, but understand that my sense of humor is not always compatible with other's. If you have a problem with something I post, you can send me a PM to address it.
  • iqbalmadiqbalmad Member Posts: 179
    guys,

    so much fuss abut a little problem.

    well, from the beginning I had my codes..
    i wrote in pseudo codes, so that i cud express myself clearly.

    I happen to find my solution by myself..

    wat i wanted was just a little guide so that i can achieve smthig..

    i think i joined the wrong forum 4 zat..
Sign In or Register to comment.