Boolean data type and flowfield

jsalehjsaleh Member Posts: 6
HI All,

I am new to this forum.

Though I tried to search for my topic, but didn't quite understand the solutions proposed - probably due to my limited experience with Navision 3.7.

I have a Boolean field in my Sales Line table that I would like to bring into my Purchase Line table using flowfield.

I am establishing (or trying using calcformula) the link between Purchase Line and Sales line via Line No. field that gets copied to the Purchase Line table for every line.

I would also like to be able to modify the boolean field from the Purchase side. (Is it even possible with flow fields?)

How can I do this? I 've tried using Lookup and Exist function but no luck.

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    It is not possible to change a flowfield. There is one exeption, but that might be to complicated and has noting to do with booleans.

    What is it you need? It sounds more like a c/al function geting information from the salesline and retruning some information when the value is changed on the purchase order.

    PS: Welcome here and enjoy :mrgreen:
  • SavatageSavatage Member Posts: 7,142
    I've read it a few times too. What is it you need to see? I'm not getting it.

    Especially just linking Line No. fields.

    It almost sounds like you want a check mark on a po item if a sales order exists or something??

    Can you clarify.
  • johnson_alonsojohnson_alonso Member Posts: 690
    I don't think that flowfields will work. I've tried as same as what you did, but I realise I need some codings in C/AL to make it work


    Rgds,
    Johnson


    "Camino Palmero"
  • jsalehjsaleh Member Posts: 6
    I need to be able to display and control a Boolean field in the Sales Line table, called s_checked, from the Pourchase Order Form.

    I gave up on flowfield. I am trying with C/AL.

    I added a new Text Control to my PO line sub form, and assigned a new
    Boolean variable to it.

    I am able to retrieve the Boolean value and display it in the new Text Control called p_checked.

    The field is editable, so when the users change/check it in the PO form, I would like to be able to update the sales line field s_checked accordingly. I am using the following code under the OnValidate trigger of the p_checked control:


    SalesLine.RESET;
    SalesLine.SETRANGE("Line No.","Special Order Sales Line No.");
    IF SalesLine.FIND('-') THEN BEGIN
    SalesLine."s_checked" := Testing;
    END

    The field s_checked in sales line table doesn't get updated.
    I then included the following line to the above code
    CurrForm.UPDATE(TRUE);

    But it caused error "CurrForm.UPDATE method can not be called from here.

    How would I update this field?
  • jsalehjsaleh Member Posts: 6
    thanks for the help there sparky.

    Did u miss the line where i said i am new to this????
    I wasn't born with "navision talent" unlike you I guess. I have to learn this thing, unfortunately.

    Testing isn't the variable i am using in actual code. Changed it, for a reason, in the posting.

    For the rest, thanks for your help guys! I have figured this one out. But I am sure I'll be back on others.
  • SavatageSavatage Member Posts: 7,142
    Can you post what you have done? 8)
  • Alex_ChowAlex_Chow Member Posts: 5,063
    BlackTiger wrote:
    SalesLine.RESET;
    SalesLine.SETRANGE("Line No.","Special Order Sales Line No.");
    IF SalesLine.FIND('-') THEN BEGIN
    SalesLine."s_checked" := Testing;
    END 
    

    2 errors in 5 lines of code! Amaizing!

    Easy my friend. You were once new to Navision as well.
  • jsalehjsaleh Member Posts: 6
    Here is what I've done to tackle this:

    __
    Under OnAfterGetRecord event of PO Line form, I used the following code to retrieve the field from Sales Line Table:

    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type","Document Type"::Order);
    SalesLine.SETRANGE("Document No.","Special Order Sales No.");
    SalesLine.SETRANGE("Line No.","Special Order Sales Line No.");
    IF SalesLine.FIND('-') THEN
    PriceApproved := SalesLine."Price Approved";


    To write the updated value back to the Sales Line Table:
    I used the following code under the OnPush event of the control:


    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type","Document Type"::Order);
    SalesLine.SETRANGE("Document No.","Special Order Sales No.");
    SalesLine.SETRANGE("Line No.","Special Order Sales Line No.");

    IF SalesLine.FIND('-') THEN BEGIN
    SalesLine."Price Approved" := PriceApproved;
    SalesLine.MODIFY;
    END

    __


    Now sparky, feel free to suggest improvent, but spare me the russion wisdom.
  • DenSterDenSter Member Posts: 8,307
    Don't do:
    jsaleh wrote:
    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type","Document Type"::Order);
    SalesLine.SETRANGE("Document No.","Special Order Sales No.");
    SalesLine.SETRANGE("Line No.","Special Order Sales Line No.");
    IF SalesLine.FIND('-') THEN
    PriceApproved := SalesLine."Price Approved";
    You already have all primary key values, so using GET is more efficient:
    IF SalesLine.GET("Document Type"::Order,"Special Order Sales No.","Special Order Sales Line No.") THEN 
     PriceApproved := SalesLine."Price Approved";
    

    Same with the next piece of code, don't set filters and FIND, use GET with
    the primary key values instead.
  • PoebblesPoebbles Member Posts: 35
    BlackTiger wrote:
    Also, I like standards. Development standards, coding standards. Beleive me it helps me everyday very much. I like Navision standards. And, yes, field names like "f_abc_1" makes me angry, even in some "theoretical" and "test" code. Filter on "Line No." without filtering by "Document No." makes me angry too.

    =D> =D> =D> ...me too
    BlackTiger wrote:
    Yes, everyone is/was a "beginner" in something. But skipping basic manuals like DevGuide - just stupid (IMHO).

    ..... like e.g. read your f**** notes. yes, you're right...
    BlackTiger wrote:
    Also I hate current "software business" itself. Main goal now - to sell! Sell, sell, sell, sell. Nobody thinking about quality, nobody thinking about quality of developers, everybody just thinking how to sell. It's causing a lot of problems, because developers just "underexperienced" and "undereducated" because a lack of time to educate. Also there is alot of "developers" which are developers just bcos "it's cool!" and they has "bigger salary"...
    ...no more words...
  • jsalehjsaleh Member Posts: 6
    Thanks Daniel!
  • DenSterDenSter Member Posts: 8,307
    You're welcome :). So much easier to just answer the question isn't it :mrgreen: Keep the questions coming, don't be shy, soon you will be answering them yourself.
Sign In or Register to comment.