For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 8 replies, 3 voices, and was last updated 14 years ago by
Kale.
-
AuthorPosts
-
Celeste PatinMemberHi:
I have attached my modified APP for Iphone. There are 5 screens:
1st – CAS Screen – Moves to Tool Screen
2nd – TOOL – Input days and click on weekly
3rd – WKLY – input weekly totals, no of wks to get a daily avg–this is passed to RESULTS
4th – DISC – input numbers and calculates a factor of sales–this is passed to RESULTS
5th – RESULT – the fields that were passed are there but this screen is not calculating.I have successfully created the calculations in all of the screens but now on the last screen (RESULTS), it puts zeroes in the place where it used to calculate. It stopped calculating when I put in the code updateResultsScreen() to pass the days on the TOOL screen to the RESULTS screen.
I have tried all different scenarios and cannot figure out what is wrong. Can someone please help? I know someone can take a look at the source code and tell me what is wrong.
Thank you for all of your help.
Celeste
Attachments:
You must be logged in to view attached files.August 1, 2012 at 2:01 am #328638
KaleMemberHi,
please provide your www folder too.
Kale
August 1, 2012 at 6:59 am #328642
Celeste PatinMemberThanks Kale. I was in a hurry. Thanks for the help. I know it’s probably something simple, but I can’t figure it out.
Celeste
Attachments:
You must be logged in to view attached files.August 1, 2012 at 9:38 am #328645
KaleMemberIt seems that your updateproLostSalesText() function is not called.
Kale
August 1, 2012 at 2:10 pm #328657
support-octavioMemberHi Celeste,
I filled the textfields with random values and get this screen result:
See attachment results-celeste.jpg
Is that correct or incorrect? I see the highlighted textfields filled with numers.
Attachments:
You must be logged in to view attached files.August 1, 2012 at 5:35 pm #328661
Celeste PatinMemberHi Octavio & Kale:
It is still not working. I sent you another file (same as the first) but color coded so you will know what cells are user input ([size=150]green) and what cells are calculated (white). The RESULTS screen should be all calculated.
On that screen the cells are:
1 – Days – brought over from the TOOL screen
2 – Average – brought over from the WKLY screen
3 – Lost Sales – calculated (1 X 2)
4 – Expenses factor – brought over from DISC screen
5 – Expenses – calculated (3 X 4)
6 – Loss – calculated (3 – 5)Kale: When I add on line 328 updateproLostSalesText() the numbers that are brought over from other screens (1,2 & 4 above), are brought over correctly but the calculated fields (3,5 & 6 above) have zeroes in them.
When I take out the call on line 333 of updateproLostSalesText() the calculated fields have nothing in them.Thank you for your help. You are both very patient.
Celeste
Attachments:
You must be logged in to view attached files.August 2, 2012 at 3:40 am #328669
KaleMemberIt makes no sense to call a function in a function that itself is never called 😉
I deleted the function call updateproLostSalesText() in the function itself, just because if the function originally would be called, it then would call itself again.
The problem is, that you don´t call the updateproLostSalesText() function anywhere, where it would make sense 😉
So I tried to call the function before the RESULTS Screen is loaded and it worked. Your function updateResultsScreen() does all the work.
Try to insert
if (targetPageId == ‘#m1-RESULTS’) {
updateResultsScreen();
}in the prePageTransition function, so it looks like this:
phoneui.prePageTransition = function(currentPageId,targetPageId) {
// add custom pre-transition code here
// return false to terminate transition
if (targetPageId == ‘#m1-RESULTS’) {
updateResultsScreen();
}
return true;
}Don´t forget to delete the function updateproLostSalesText() in updateproLostSalesText() so that it looks like this:
function updateproLostSalesText() {
//read Work Days in POR X average daily sales input values
// inspect the html file to get the field IDs
var res1 = parseInt($(‘#m1-RESULTS-results5Field’).val(), 10);
var res2 = parseInt($(‘#m1-RESULTS-results6Field’).val(), 10);//convert all non-numeric (NaN) inputs to 0
res1 = isNaN(res1) ? 0 : res1;
res2 = isNaN(res2) ? 0 : res2;//compute projected lost sales
ans = res1 * res2;//display total
$(‘#m1-RESULTS-proLostSalesText’).val(ans);
updatediscExpText();
}
KaleAugust 2, 2012 at 2:40 pm #328685
Celeste PatinMemberHi Kale:
YEA! THAT WORKED!
You said that “…you don’t call the updateproLostSalesText() function…where it would make sense…” I couldn’t figure out where to put it. I didn’t know about the “prePage Transition function”. Is there somewhere I could read about the capabilities of those functions above the ready handler? Also, the updateproLostSalesText() is called in the functionupdateResultsScreen() (line 332-336). If I take that call out, it doesn’t work, so I left it in.
This may be a dumb question to you but why do I have to put code in the pre page transition for my calculations to work? It would seem that the update functions would send the information to the RESULTS screen and it should appear there. I’m trying to learn all of this as well as develop this for actual production. Remember, I’m an accountant with some programming experience but not up to par with you guys.
I need to transfer 6 other input data fields from the TOOL screen to the RESULTS screen. That should be no problem as they don’t affect any of the calculated items. Right?
On another posting–sending the results to an email –
Does that code go at the bottom of all of the code (in the ready handler)? Do I just put the code in as you described with just changing the label names and the values? Do I set the email pushbutton on the RESULTS page to js function email()?Thank you for all of your help. I really appreciate it. I think others will also learn from these posts too.
Octavio: I want to thank you also. I know you are busy but you have also been a great help.
Thanks for being patient with me. Celeste
August 3, 2012 at 3:39 am #328713
KaleMember@CelesteP wrote:
Hi Kale:
This may be a dumb question to you but why do I have to put code in the pre page transition for my calculations to work? It would seem that the update functions would send the information to the RESULTS screen and it should appear there. I’m trying to learn all of this as well as develop this for actual production. Remember, I’m an accountant with some programming experience but not up to par with you guys.
It is not a dumb question at all. The answer is you don´t have to put the code in prePageTransition in order to pass the results to your results screen. There are several ways to accomplish this. For example you could use a button that calls the function, or you call the function after the last necessary user input.
In the actual case the function is called before (pre) transition to the results screen. Your functions need to be called by an event to work. This event can be a buttonclick, a certain time or anything else that triggers an event. Everytime a page transition is being made, the function prePageTransition is called before the transiton and all the code inside will be executed. After that the program transitions to the new page. Then the function postPageTransition is called automatically.
@CelesteP wrote:
I need to transfer 6 other input data fields from the TOOL screen to the RESULTS screen. That should be no problem as they don’t affect any of the calculated items. Right?
Correct.
@CelesteP wrote:
On another posting–sending the results to an email –
Does that code go at the bottom of all of the code (in the ready handler)?You can put the code wherever you want, as long it is outside of an existing function. The email function should only be called when the email button is pressed.
@CelesteP wrote:
Do I just put the code in as you described with just changing the label names and the values? Do I set the email pushbutton on the RESULTS page to js function email()?
Both is correct.
@CelesteP wrote:
Thank you for all of your help. I really appreciate it. I think others will also learn from these posts too.
Octavio: I want to thank you also. I know you are busy but you have also been a great help.
Thanks for being patient with me. Celeste
You´re welcome 🙂
Kale
-
AuthorPosts
