Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 29

Thread: Help with Computation

  1. #11
    Join Date
    Mar 2007
    Posts
    26

    Default Re: Help with Computation

    Great.. thanks so much for your help...!

    That looks like it should work. My hosting company is having a short outage.. so I wont know for sure until they come back up grrrr!

    All the instructions have been very clear and helpful... which is great for someone like me, as my coding skills are very very, well, basically non existant!

    I have also found the error emails you get (when the form fails) very helpful... very handy for pointing out my inability to type accurately! I think without them, I would have given up.... its amazing how many 1 digit typing mistakes I make!

    Thanks again, I will post back when I have confirmed it all works.

  2. #12
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Help with Computation

    Hi,

    stamper: your original code looked fine. If you're still having problems, please post the URL so we can check out the code in detail.

    elso...

    Don't know why all the extra spaces were inserted in the code tags in my previous post. This happened when I previewed and edited my post. Maybe Russell can explain what happened here
    Yes, the editor in these forums (which I think is just built into the browser) doesn't really handle indentations properly.

    I find sometimes it works great, and other times I just give up!

    Perhaps we should try writing the code in Notepad and then copy-and-paste the completed code between code /code tags.

    And thanks for helping out stamper (and others)! I think you're contributions to the forums have been great.

    Just one thing to note: if.../if tags in Advanced Templates are only available to users of FormMail Computation Module version 2. Currently, only source-code licensees such as yourself have this version available to them.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #13
    Join Date
    Feb 2007
    Posts
    72

    Default Re: Help with Computation

    Thank you for your vote of confidence
    I have always found my best means of understanding is to help others when possible.

    By all means if you see me make an inaccurate statement or other error, butt right in and correct me

    I will use notepad for future code postings as you suggested.

    Are there other versions of the Computation Module? I was going on the idea that if someone was talking about fmcompute functions, like stamper, they had a licensed copy of the Computation Module. Please correct me if this is wrong.

    I am still have troubles with my upload session but I haven't been able to compile any conditions to make it predictable. Sometimes it will upload and sometimes it won't. Not convinced yet, but I am starting to think some of the troubles may have to do with my hosting company. Haven't yet confirmed this though, but I will shortly.

  4. #14
    Join Date
    Mar 2007
    Posts
    26

    Default Re: Help with Computation

    Hi Elso...

    in your example you said to use:

    import int iQuantity;
    which i did try, but i was getting errors like:

    Line 4, position 13: Data item 'iQuantity' has type 'string' not type 'int' that was specified.

    So, I tried changing iQuantity to type 'string' and now it works just fine!

    So, I think for now, I have things running the way I need. Though, I am sure that I will have some changes to make that I will need a hand with.

    I am slowly beggining to comprehend how this works..... unfortunately I dont have a programmers brain.... so it takes me a little longer to understand how this all works.

    But, again, Elso, your help (and of course Russells) has been great......

    Thankyou.

  5. #15
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Help with Computation

    Hi,

    re there other versions of the Computation Module? I was going on the idea that if someone was talking about fmcompute functions, like stamper, they had a licensed copy of the Computation Module. Please correct me if this is wrong.
    Yes, stamper has a licensed copy of FCM, but he has version 1, as do most others.

    Version 2 is currently only available as a source code license, and we've only provided it to customers who've contracted significant development work from us, such as yourself.

    The aim is provide version 2 as an inexpensive service from our server *or* as a source code license.

    Unfortunately, the Zend Encoder system we used for protecting version 1 turns out to be PretendWare - it doesn't work in protecting PHP code from theft or tampering. And now Zend want big bucks very year to use it.

    So, the fact that it doesn't really protect PHP code from theft or tampering *and* costs lots of money means we've given it the flick.

    As a consequence, we're having to re-think the delivery strategy for FCM.

    Let me know if you want me to take a look at the upload problem.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  6. #16
    Join Date
    Feb 2007
    Posts
    72

    Default Re: Help with Computation

    Hi Stamper

    That may have been my error on the import "int" because now that I think about it, I think I ran into the same issue and changed the "import int" to "import string". Sorry bout that

    You don't need to have a programmer's brain, just a logical one

    I am not a programmer and have zero formal education in this stuff. In fact my line of employment is a chef And the only form education I have is a mechanic

    Seems like you have a logical mind to follow this stuff so you will do just fine.

    Nelson

  7. #17
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Help with Computation

    Hi,

    mport int iQuantity;
    which i did try, but i was getting errors like:

    Line 4, position 13: Data item 'iQuantity' has type 'string' not type 'int' that was specified.

    So, I tried changing iQuantity to type 'string' and now it works just fine!
    Yes, all fields on a form are really strings. There are no integers, floats, or anything else. Everything is a string.

    So, currently, FCM insists that when you import a field, you know that you're importing it as a string. You can convert it to an int or float after that, if you want.

    Code:
    import string iQuantity;
    int i_qty;
    
    i_qty = iQuantity;
    In a later version we may relax this to allow for automatic conversion to whatever FCM type you want during the import.

    Of course, in this case, a bad conversion would cause an immediate error (e.g. trying to convert "hello world" to an int).

    Explanation

    For computations it's much better to work with a strongly typed language (as a long-term computer scientist, I have major problem with languages that don't define types for variables - they usually cause more problems than they solve).

    So, the lanuages I've designed, like FCM, have two important features (the more important one is first):
    1. Variables must be declared before they can be used. I still don't understand why perfectly intelligent people insist on designing languages that dont' require this. Without this requirement, just about everything you write will have bugs caused by simple typos!
    2. The language should be strongly type, with strict conversion rules between types.
    It makes it more verbose, but at least you don't spend hours or days trying to track down silly bugs caused by typos.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  8. #18
    Join Date
    Mar 2007
    Posts
    26

    Default Re: Help with Computation

    i always wanted to be a chef... :-) now i just settle for watching cooking shows on tv instead

    here is the next question :d

    actually... this is semi unrelated to what we were just talking about it... but, I suspect will be Computational related.

    I have a drown menu as such:

    HTML Code:
             <select name="Simulate" id="Simulate" onchange="getCityList2(this)">
                      <option value="">Select</option>
                      <option value="1">Yes</option>
                      <option value="2">No</option>
                    </select>
    ..which is being used in the calculation of my price...

    Here is the situation. Proceeding that drop down, there is a question: "Do you have 3D Die Face data?" of which they can answer YES or NO. If they answer YES, there is a cost of $495, if answer NO there is a cost of $995. That is all OK, and working as it should right now.

    What I need is the ability to output YES and NO with alternative descriptions. To clarify that:

    If they choose YES, then the are infact purchasing a product called SimulateLite. If they choose NO, they are infact purchasing a product called SimulateComplete.

    So, on the email/receipt, it would read something like this:

    Q. Do you have 3D die face data? A. Yes. Then you need product SimulateLite

    Q. Do you have 3D die face data? A. No. Then you need product SimulateComplete.


    Hope this makes some sense.

  9. #19
    Join Date
    Feb 2007
    Posts
    72

    Default Re: Help with Computation

    Hi Stamper

    This can be done a couple different ways. One would be to use your derive_fields, but this option you would need to modify your dropdown to be only a true or false/on or off/something or nothing type of value thus removing your default "select" instruction and then modify your JavaScript some so it will still function. But since you have the FMC mod it will be a whole lot simpler, in fact after I explain you should begin to see a pattern when compared to previous post.

    Simply in your FMC field add another import string:
    Code:
    import sting  Simulate;
    Then add in another export string;
    Code:
    export string   sDescription;
    Then we want to ensure this new export string is empty, so add in:
    Code:
    sDescription = '';
    Now we have fields to play with
    Code:
    if (Simulate == '1')
    {
    sDescription = 'Yes. Then you need product SimulateLite';
    }
    elseif (Simulate == '2')
    {
    sDescription = 'No. Then you need product SimulateComplete';
    }
    Are you seeing a pattern to previous post?
    You can create any fields you need using the "export" then set the values of these newly exported fields with anything you need that can be based on values from your user form. Once you get the hang of this, it is quite simple to follow.

    Have fun with this, it's quite flexable on what you can make happen with FMC mod.

    Nelson

  10. #20
    Join Date
    Apr 2008
    Posts
    23

    Default Re: Help with Computation

    This suggests all sorts of questions about what can and can't be done with the computation module.

    First off, what data types do we have?

    From above, we can see that we have multiple data types - there are strings and floats.

    Are there also integers? If so, how to initialize them?

    export int?

    What do all the arguments to initialize the float mean?

    It looks to me like you've got a "number of digits after the decimal point" argument, a "decimal point separator" argument, and then something which you're passing a comma to - I assume thousands separator?

    How strongly typed is this little language?

    We can also see:
    We need a semicolon after each statement ; ,
    Comments can be defined with /* */
    We have an
    if () { ... } elseif () { ... } else { ... }
    type of construct ...

    And how do the error functions work?
    Do you just go
    if (something) { FMUserError('something') }
    ?

    Sorry, lots of questions, but this just opens up a whole can of worms for my mind wanting to know what is and isn't possible, since there doesn't seem to be much documentation on this, save for the sample and what's in the forums ...

    Also is it possible to put the "fmcompute1", ... fields into the .ini so as to hide your form computation logic from the world?



    Thanks!
    Last edited by aaron_w; 08-May-2008 at 11:44 PM. Reason: unintentional smiley

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Paypal link to buy Computation Module.
    By billy in forum FormMail Computation Module
    Replies: 6
    Last Post: 27-Apr-2009, 05:39 AM
  2. How to do simple computation
    By pbrienesse in forum HOWTO Guides and Tips
    Replies: 2
    Last Post: 22-Jan-2009, 06:40 PM
  3. Do I need the FormMail Computation Module?
    By smaynar in forum FormMail Computation Module
    Replies: 2
    Last Post: 21-Oct-2008, 03:40 AM
  4. Just getting started with computation module... failing utterly.
    By Tony.Jackson in forum FormMail Computation Module
    Replies: 1
    Last Post: 09-Apr-2008, 06:58 PM
  5. derivative, computation and order_id
    By kreon in forum Community Support
    Replies: 1
    Last Post: 17-Oct-2006, 08:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •