facebook

Custom Calculations

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #337592 Reply

    CygnusX3
    Member

    Pretty simple idea, but i’m super new to app development.

    At my job we use some simple math that i am trying to make an app for.

    Example of typical usage:

    (40 (width of a pallet) * 48 (length of a pallet) * 12 (height of items on pallet)) / 1728

    This gets us our cube of the pallet. I am trying to get a calculation app where you just check a radio button or box etc to select either large or small pallet (small pallets are 35 by 45) and manually enter the height.

    Then something for manually inputting item weight * number of items to (plus weight of pallet, which is static at 120 lbs).

    So i have a pictue in my head i just can’t figure out how to get it into an app.

    #337595

    Brandon
    Member

    My suggestion is to do a layout in Mobione with what you could like it to look like, it may then be easier for someone to post some sample code.

    #337641

    CygnusX3
    Member

    You make a great point sir and i shall return with some screens

    #337642

    CygnusX3
    Member

    Ok, some visual aids (i kept it as simple as possible).

    so what i am looking to do is basically run 2 calculations when you press the calculate button (dependent on the input values) and feed the results into the table.

    so something along the lines of:

    ([Pallet Size] * [item height])/1728 (the checkbox would need to feed the appropriate size into the equation)

    (Unit Weight * Unit Quantity)+120

    Then have those 2 results fed into the Result cells.


    I have decent experience with HTML4/CSS. Limited experience with HTML5 and next to no experience with Javascript. So i apologize for the simplicity of this request.

    #337649

    CygnusX3
    Member

    Or perhaps replace the check boxes with separate submit buttons, where each buttons submits the pallet values prior to calculating.

    #337654

    nvts
    Member

    Looks pretty straight forward.

    You will need to get the info from M1 for each field height,weight, quantity for each

    height = document.getElementById(“m1-screenname-HeightTextField”).value;

    Then write the js function in your app_custom.js file

    Call the function from the buttons action calcpallet();

    Then write it back to the 2 other text fields Item Cube & Total Weight

    $(‘#m1-screenname-itemcube’).val ( );

    Cheers…

    #337655

    CygnusX3
    Member

    That info gives me a much better understanding of what i need to do. But in a very broad sense :P.

    I think i have a final working design:

    So, here’s the plan in a nutshell:

    Text fields are filled in by user.

    Clicking Large Pallet grabs item height and calculates (Item Height * 40 * 48) / 1728 and feeds the result to the table cell on the left.

    It also grabs the Unit weight and Quantity and multiplies them together (Weight * Qty) + 120 and feeds the result to the table on the right.

    Clicking Small Pallet does the same thing except (Item Height * 35 * 45) / 1728. Weight calculation stays the same.

    Im a super newbie, so basically what i need is “This is the code to grab info from fields”. “This is the code for math calculations”. “This is the code for feeding into the table”. Obviously i know the ID of each field so filling that in is cake :P.

    #337656

    nvts
    Member

    Have you written js code before or is that what you are needing to be done?

    I am also a newbie. The best part is a lot of the samples that others have posted to see how the js code interacts with MobiOne designer.

    If you need the code developed. zip what you have above and post it. Then I will be able to use your design and field names so you can see how this works.

    Cheers…

    #337667

    CygnusX3
    Member

    Will get the file up ASAP. need to get it off the wife’s computer that i was using last night (japan time).

    #337668

    CygnusX3
    Member

    next question…do i need to google a file sharing site to host this zip so you can DL it?

    #337670

    nvts
    Member

    No,

    Just attach it to the reply. Under the image verification.

    #337674

    CygnusX3
    Member

    So i am horrible with WinRAR too i guess, it doesnt size the file down very much..only to 2MB wich is 1500 KB over the limit

    #337676

    Brandon
    Member

    Try something like this:

     
    //Untested just to give you an idea for the code
    //for large
    myLarge = $('#m1-myform-itemHeightText').val() * 40 * 48;
    $('#m1-myform-itemTotalLeft').val(myLarge) ;
    
    //for small
    myLarge = $('#m1-myform-itemHeightText').val() * 35 * 45;
    $('#m1-myform-itemTotalLeft').val(myLarge); 
    
    myWeight = $('#m1-myform-itemUnitWeight').val() *$('#m1-myform-itemUnitQuantity').val();
    
    $('#m1-myform-itemTotalRight').val(myWeight ) ;
    
    
    #337678

    nvts
    Member

    Since you are having upload problems. It will be good practice for me with the calcs that I have waiting for this.

    I will just put a quick app similar to your screens for you to see.

    Cheers

    #337680

    nvts
    Member

    Cincy posted good example code. Except change the myLarge for the mySmall calcs :).

    I will post my sample for you, if you would like.

    Cheers…

Viewing 15 posts - 1 through 15 (of 20 total)
Reply To: Custom Calculations

You must be logged in to post in the forum log in