D3 and mvBase

 View Only
  • 1.  Boolean Algebra

    Posted 05-04-2023 12:59

    Please could some boffin convert the following f-correlative into a maths formula with appropriate parentheses (brackets)

    AI was close but not good enough!

    F;0;(TPAMASTER;X6;;7);"2";0;(TPAMASTER;X5;;7);*;+;"3";0;(TPAMASTER;X4;;7);*;+;"4";0;(TPAMASTER;X3;;7);*;+;"5";0;(TPAMASTER;X2;;7);*;+;"6";0;(TPAMASTER;X1;;7);*;+;"7";0;(TPAMASTER;X2;;45);*;+;"19";+;"29";/;"300";*;"2";/;"90";+;"100";/

    I can fathom the first part to be (7.6 + 7.5 x  2 + 7.4  x 3 + 7.3 x 4 + 7.2 x 5 + 7.1 x 6  + 45.2 * 7 + 19) / 29 => where 7.6 is attribute 7.6 of file PAMASTER, etc
    But I just cannot fathom the rest with the correct brackets.

    Help! :))



    ------------------------------
    Roland Von Hoesslin
    Owner/Manager
    Crystal Logic
    Cape Town ZA
    ------------------------------


  • 2.  RE: Boolean Algebra

    Posted 05-05-2023 07:33

    Roland, best of luck! 

    Maybe if you break it up into several DICTs you can decipher it. 



    ------------------------------
    Peter Gonzalez
    St. Louis, MO US
    ------------------------------



  • 3.  RE: Boolean Algebra

    PARTNER
    Posted 05-05-2023 08:58

    (((((7.6 + ("2" * 7.5)+("3" * 7.4)+("4" * 7.3)+("5" * 7.2)+("6" * 7.1)+("7" * 45.2)+"19")/"29")*"300")/"2")+"90")/"100"

    7.6
    +
    "2" * 7.5
    +
    "3" * 7.4
    +
    "4" * 7.3
    +
    "5" * 7.2
    +
    "6" * 7.1
    +
    "7" * 45.2
    +
    "19"
    /
    "29"
    *
    "300"
    /
    "2"
    +
    "90"
    /
    "100"



    ------------------------------
    Mike Young
    Senior PS Techical Consultant
    Aptean
    Atlanta GA US
    ------------------------------



  • 4.  RE: Boolean Algebra

    Posted 05-05-2023 11:31

    Hi Mike

    Thanks very much for your response.

    D3 returns whole numbers so I had to intergerize your formula and all is good.

    I can now use it in a much more complicated subroutine used for forecasting.

    Much appreciated!

    Roland

    SUBROUTINE B.IDEAL.CHK(VAR)
      tkey = var
      var  = 0
     
      open 'pamaster' to pamaster else return
      readv msales from pamaster,tkey,7  else return
      readv rsales from pamaster,tkey,45 else rsales = ""
     
      sq1  = msales<1,6> + 2 * msales<1,5> + 3 * msales<1,4> + 4 * msales<1,3>
      sq1 += 5 * msales<1,2> + 6 * msales<1,1> + 7 * rsales<1,2> + 19
      var  = int((((int(sq1 / 29) * 300) / 2) + 90) / 100)
    return
    *************************************************************************
    end
    Dict Ideal has the Boolean Algebra ; dict Ideal .chk calls the subroutine.
    pamaster............ Ideal  Ideal Chk
    4021800009 ....... 21 ...... 21
    4030160321 ........ 29 ..... 29
    800036410000 ... 23 ..... 23
    0010000207 ....... 33 ..... 33
    007603024106 .... 50  .... 50
    074361022203  ... 110 .... 110



    ------------------------------
    Roland von Hoesslin
    Owner/Manager
    Crystal Logic
    Cape Town ZA
    ------------------------------



  • 5.  RE: Boolean Algebra

    PARTNER
    Posted 05-05-2023 09:29

    Roland,

    I hope this is correct and works for you...

    ( ( ( ( ( (7.6) +  (2 x 7.5) + (3 x 7.4)+(4 x 7.3) + (5 x 7.2) + (6 x 7.1) + (7 x 2.45) + 19 ) /29) x 300) / 2 ) + 90 ) /100

    best regards

    Phil Griffiths
    Qualtec Systems, UK



    ------------------------------
    Phil Griffiths
    Director
    Qualtec Systems Ltd
    Birmingham GB
    ------------------------------



  • 6.  RE: Boolean Algebra

    Posted 05-05-2023 11:43

    Thanks Phil; you are also on the button; I'm very grateful for the responses I got.



    ------------------------------
    Roland Von Hoesslin
    Owner/Manager
    Crystal Logic
    Cape Town ZA
    ------------------------------