facebook

Calculate Average on 1 Screen & Send Results to Other Screen

💡
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 22 total)
  • Author
    Posts
  • #327848 Reply

    Hi Wayne & Octavio (and all members):

    I’ve created my app with 7 screens. One one screen I have calculated the average of two years sales and placed the result in a text field on the same screen.

    Now I want to also put that result on the third screen to perform other calculations.

    I’ve look at your example “Custom Actions Demo” and my issue is like the last push button (Custom Function) where you send the date to the third screen.

    In my case, I would be sending the calculated result that is in a text field to a field on another screen.

    Can you tell me how to do this, PLEASE? Are there similar examples that you have posted to do this?

    Thank you in advance for your help.

    Celeste

    #327941

    Hi CelesteP,

    You should use a similar snippet that I suggested here:
    http://www.genuitec.com/support-genuitec/viewtopic.php?p=8533#p8533

    Your function can be something like this:

    function TotalScreen() {
    
    var total = $('#m1-mainPage-textfield1').val();
      $('#m1-secondPage-textfield1').val(total);
      // ...
      //show the second screen
      phoneui.gotoPage('m1-secondPage',null);
    }
    #327986

    Octavio or Wayne:

    I’ve uploaded my compressed file. It is just 2 screens. The 1st is the WKLY screen which calculates a daily average. After the computation, I want to send this daily average to the RESULTS screen and put it in the field “results6Field”.

    Octavio: When I tried to add the code you suggested, it does not work. Also, with putting that code in the custom file it doesn’t calculate the totals any longer on the WKLY screen.

    What am I doing wrong? Can you please review and let me know? I have a few fields that I want to transfer to RESULTS or another screen like this.

    Thank you for your help.

    Celeste

    Attachments:
    You must be logged in to view attached files.
    #327987

    Kale
    Member

    Hi,

    didn´t check your programm, just saw that your function updateTotalScreen() is missing a “{“.

    Kale

    #327989

    Hi Kale:

    Thank you for pointing my error out. When I put in the {, the totals did come back. I still can’t get it to send the total to the next page.

    Thanks again,

    Celeste

    #327990

    Kale
    Member

    Hi,

    I changed the code a bit. A change of a textfield value is obviousliy not recognized when the change is not done by hand. So after the last value input you have to tap somwhere outside of the textfield and the transition starts and shows the value on the results page.

    Hope it helps.

    Kale

    Attachments:
    You must be logged in to view attached files.
    #327991

    Hi Kale:

    Thanks for debugging but I still can’t see the field on the next page. I’ve input your code (did you just change the area below) and I ran it in the emulator and input the values and clicked outside the text area and the daily value still does not appear (for me) on the RESULTS screen. I don’t understand what I’m doing wrong. Can you help? I really appreciate it.

    Thanks,

    Celeste

    function updateTotalScreen() {
    var total = $(‘#m1-WKLYSales-totalAvgDailyText’).val();
    $(‘#m1-RESULTS-results6Field’).val(total);
    //…
    //show the second screen
    phoneui.gotoPage(‘m1-RESULTS’);
    }

    #328007

    Hi CelesteP,

    Pleas try adding a Link widget and set its click action to a GoToScreen action that references a screen that you need to include when code is generated, in your case your result page. This is a wayne’s tip, you can read more about it in this thread: http://www.genuitec.com/support-genuitec/viewtopic.php?p=4543#p4543

    Let me know if this is helpful for you.

    #328022

    Hello:

    It still does not work. What else can I try? I have several totals that I need to send to other pages. Does anyone have any ideas?

    Thanks,

    Celeste

    #328025

    Kale
    Member

    @CelesteP wrote:

    Hi Kale:

    Thanks for debugging but I still can’t see the field on the next page. I’ve input your code (did you just change the area below) and I ran it in the emulator and input the values and clicked outside the text area and the daily value still does not appear (for me) on the RESULTS screen. I don’t understand what I’m doing wrong. Can you help? I really appreciate it.

    Thanks,

    Celeste

    function updateTotalScreen() {
    var total = $(‘#m1-WKLYSales-totalAvgDailyText’).val();
    $(‘#m1-RESULTS-results6Field’).val(total);
    //…
    //show the second screen
    phoneui.gotoPage(‘m1-RESULTS’);
    }

    What happens when you try it only with the two pages you submitted here and replace the WKLYSales_custom.js with the file I have provided? Maybe it doesn´t work when you use it in your whole project. Can you submit your whole project here? Would be helpful.

    Kale

    #328052

    Hi Kale:

    I replaced the custom file with the one that you have and that worked for the 2 screens that I provided to you. THAT WORKED!

    The calculation worked and it went to the results screen and put the daily average there.

    When I incorporated the change to my real APP (all of the screens) I can’t get it to work. The calculation works but it doesn’t go to the other screen and put the daily average on that screen.

    I will upload my whole project shortly.

    Thank you for your help.

    Celeste

    #328064

    Hi Kale:
    I JUST TRIED TO ATTACH THE ZIPPED FILE AND IT IS 1466 KB AND I GOT THE MSG “FILE IS TOO BIG, MAX ALLOWED SIZE IS 500KB”. WHAT DO I DO NOW?

    I have attached my APP–all screens for now. What I found is that when I run the emulator from let’s say the CAS Screen, none of the calculations work. But, if I run the emulator from the WKLYSales screen or MTHLY or ANN the calculations work. Is there maybe a problem with the first screen? They were working all together until I started trying to send the avg daily to the RESULTS screen.

    So here is the order that the screens should work”
    1 – CASScreen, 2 – TOOL, 3 – WKLYSales, 4 – MTHLYSales, 5 – YRLYSales, 6 – DISCEXP, 7 – RESULTS, and 8 CAS CONTACTS.

    From the CASScreen the user can select the TOOL and fill in the data and select whether the have weekly, monthly or yearly sales and then go to those screens. Going to the weekly screen you can fill in weekly data and get a daily average. Then you should go to the DISCEXP screen to calculate expenses. Then fields (i.e. the daily average) should be transferred automatically to the RESULTS. I would like this page to eventually be emailed. I think I know how to do that I just want to make the fields start calculating and working together again. Then the last page is just a contacts help screen. I had put in telephone numbers and took them out for this example.

    Note: All screens at the bottom have a “Back” button which seems to work fine to go to the previous screen. The middle button takes you to the 1st screen.

    Also, only the daily average is coded right now to go to the RESULTS screen. MTHLY and YRLY don’t have the coding yet. When I/you/whoever fixes the screens not working together I will finish the coding for those to send the data to the RESULTS screen.

    Thank you for your help. Sorry to bother so much but I am an Accountant trying to do this project for my work. I really appreciate the help you or anyone can give.

    Thanks,

    Celeste

    #328073

    Wayne, Kale or Octavio:

    Here are all 8 of my screens. I made a copy of each file and put an X in the front of each name. When you extract them, please take off the X and all the code written thus far should be available and I stated in my last email.

    Again, when they are all together, the calculations do not work. When sent to the emulator individually they work. The WKLYScreen has code to send the daily avg to the RESULTS screen. This does not work when they are all emulated together.

    Please help as I do not know what I am doing wrong.

    Thank you,

    Celeste

    Attachments:
    You must be logged in to view attached files.
    #328083

    Kale
    Member

    Hi,

    the problem is a missing reference from your input screen to the RESULTS screen as octavio already mentioned. I could solve the problem by inserting a link widget somwhere in WKLYSales with no text and width=0 and a gotoScreen action to RESULTS Page.

    BTW: avoid alert popups, just use them in case of errors or false user inputs 😉

    Kale

    #328089

    Hi:

    So a link widget does not need to be “pressed”, it will just automatically go to the screen that I set it to?

    Sorry Octavio if I didn’t understand you when you told me this.

    I will also take out the pop-ups. The boss wanted those in there but they will come out.

    I will try this a little later and let you know what happens. Thanks again for all the support to you, Octavio and Wayne.

    Will chat later. Thanks,

    Celeste

Viewing 15 posts - 1 through 15 (of 22 total)
Reply To: Calculate Average on 1 Screen & Send Results to Other Screen

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