CAN ANYBODY HELP ????

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

CAN ANYBODY HELP ????

Post by smash » Tue Mar 10, 2009 11:27 am

can anybody give me SOME IDEA on how to do the below ???
it seems you have to be some sort of alien to work out or even undertand what the "help" guides are supose to mean.
hell i need help trying to read the help guide
thanks mark, i am getting there
now i have four woosies of questions
1)
i am using multible choice boxes, and after i have made upto 6 choices, i am trying to press one button to transfer the information across to 6 different cards.
this what i am trying to use, but it keeps tlling me it can not find the card
Quote:
on mouseUp


local theCardName

put "Entries" & menuPick into theCardName

if (field "BridleNumber" is not empty) and (field "HorsesName" is not empty) and (field "RidersName" is not empty) then

put field "BridleNumber" & tab & field "HorsesName" & tab & field "RidersName" & return after field "Entries" of card (theCardName)
put empty into field "BridleNumber"
put empty into field "HorsesName"
put empty into field "RidersName"
go card (theCardName)

else

answer "You have not completed the entry details correctly"

end if



end mouseUp



and
3) here is the woosie.

how do you put one entries information on 6 different card, so they all go into the correct slot at 50 minute intervels ???
and how do you connect the times to a card.

and
4)
is their a code for a field, that gives a warning if you have used the same number more than once ?

thank you for all your help
i hope there is someone who can put me on the right track as there is just nothing in this program to even help you understand anything, it is only this forum that gives you some idea.
crossing my fingers that someone could HELP ME
cheers

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Wed Mar 11, 2009 2:42 am

Is this like a sort of "submit" or "enter" button?

If so, then what do you expect the value of "menuPick" to be.

If it's the value chosen from a menu button, then you probably need to to do something like:

put "Entries" & the label of btn (yourMenuBtn) into theCardName

Perhaps you could describe things a bit more.

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Wed Mar 11, 2009 5:44 am

hi mark smith
amazingly i have worked out question No 1
so i thank you for time to read my post.
i am still trying to work out questions 3 and 4 though

i tell you, who ever wrote the so called help/dictionary and PDF file, must of been raised as an alien.
there is NOT ONE BIT OF INFORMATION i have been able to get off any of that goobly dock.
if it wasnt for the search button on here, where PEOPLE have posted information and codes and explained how or what to do things, i would be throwing this program all the way to MARS.
i am most likely the only dummy that cant understand the help section lol

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu Mar 12, 2009 12:14 am

i would be throwing this program all the way to MARS.
Well, would you believe it, that's exactly where the writers of the help/dictionary and PDF files live because they are indeed aliens! :lol:

Seriously smash, I get the idea you might be new to Revolution and possibly new to programming altogether perhaps? Maybe try working your way through the Getting Started progs in the Revolution Documentation. Things slowly but surely start dropping into place.
i am most likely the only dummy that cant understand the help section
No and no, meaning you're not a dummy and you're not the only person that can't understand some or all of Rev stuff. It does take a bit of patience to know that the "penny drops" every couple of months, for years. It takes time, patience, persistence and willingness to learn this stuff. What's inacessable one week can be understood the next.

There's a certain structure and balance woven into Rev which once you get the hang of it, the help files will begin to make more sense.

Hope that's helped a bit.

Best regards

gyroscope

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Thu Mar 12, 2009 1:42 am

LOL gyroscope
your post is so true lol
i am soooo frustrated at not being able to understand the Rev lingo lol
but i am trying. the sadest part, is even when i get something (like a code) i try to see if i can make sense of the dictionary thing, but am left completely all alone, staring at some alien language he he he

now i have this code
on mouseUp
put value (field "TotalFee" - field "APaid") into field "Balance"
put value (field "Balance" > 0) into field "Ostanding"
put value (field "Balance" < 0) into field "Credit"

end mouseUp
and i am trying to put the value of balance into either a credit field or an outstanding field, but all i get in those fields is a "true" or "false"

i was quiet proud of myself for working out how to add and subtract lol
yeah i know amature stuff, but i did squeal with delight when i got that bit lol

so what am i doing wrong ?? how do i get the actual numbers to replace true or false ???
thanks for your enjoyable post gyroscope
cheers

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Thu Mar 12, 2009 2:44 am

Smash, what you're doing in lines 2 and 3 is effectively

put (field "Balance" is greater than zero)...

which evaluates to true or false.

What you want is a conditional - "if"

Code: Select all

get field "Balance"
if it > 0 then
  put it into fld "Outstanding"
else
  put it into fld "Credit"
end if
You might want to change it to
if it >= 0 -- ie. greater than or equal to

We all know how frustrating this is, particularly at the beginning, but keep at it, and keep asking questions!

best,

Mark

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Thu Mar 12, 2009 4:40 am

thak you mark for your script
IT WORKED!!!!!!
now i did this to put a 0 in where i wanted to
on mouseUp
put value (field "TotalFee" - field "APaid") into field "Balance"
get field "Balance"
if it > 0 then
put it into fld "Ostanding"
else
put it into fld "Credit"
end if
if it > 0 then
put 0 into field "credit"
else
put 0 into field "Ostanding"
end if

end mouseUp
woooo whooo

now i have noticed that when something goes into the "credit" field, it comes up with say -20 (this means you have $20.00 credit)
is there a way to remove the minus sign in credit ?
is there a way to make a dollar sign $ that stays in a field that you put the amount in ?

mark thanks for your words of encouragement, it can get quiet over whelming at times
thank you

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Thu Mar 12, 2009 11:11 am

part of your code:

Code: Select all

if it > 0 then 
put it into fld "Ostanding" 
else 
put it into fld "Credit" 
end if 
try this:

Code: Select all

if it > 0 then 
put it into fld "Ostanding" 
else 
put "$" & abs (it) into fld "Credit" 
end if

but if you put the dollar sign into the field and further down the road you want to do calculations with the amount you have to take card of the dollar sign. Wouldnt it be easier to put a label field with the dollar sign before field credit?

and
on mouseUp
put value (field "TotalFee" - field "APaid") into field "Balance"
if you say:

Code: Select all

on mouseUp
set the numberformat to "####.00"
put value (field "TotalFee" - field "APaid") into field "Balance" 
it would format the the amount to two decimals.
Look up numberformat and abs.

regards bernd

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Thu Mar 12, 2009 12:29 pm

hi bn
ok now i tried

Code:
if it > 0 then
put it into fld "Ostanding"
else
put "$" & abs (it) into fld "Credit"
end if

and it worked the first time, but it went hay wire after that, some times it would make credit and out standing the same amount and then it would forget to put the $ sign in, so i am not sure what i did wrong, as i copied and pasted direct off here ???
Wouldnt it be easier to put a label field with the dollar sign before field credit?
oh yes it would, but i have "tried" to read the dictionary about abs and numberformat, but i honestly have not landed on that planet yet, i really really have tried, but it confuses me so much, i just get lost even more.
i honestly can not make heads or tails of the "help" dialog ?
bn, i even go to the dictionary AFTER i have worked something out, and there is just no way i can find ANYTHING that resembles ANYTHING.
i just have not worked out how to read the help information yet.

now i have my field handler with this
if theKey is a number then pass keydown
else if theKey is "." then pass keydown
and have tried to put this in a field handler
set the numberformat to "###.00"
but nothing happened.

but it worked a treat in front of my script (up the top of this post)

so i need to set my field handler to handle $ signs and ###.00

now how do i do that?

thanks for your input bn, i look forward to your reply
thank you

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Thu Mar 12, 2009 1:28 pm

Hi Smash,

I dont see how

Code: Select all

if it > 0 then 
put it into fld "Ostanding" 
else 
put "$" & abs (it) into fld "Credit" 
end if
could go haywire. Check the script once again.

The numberformat:

from the docs
Important! Changing the numberFormat does not automatically change the format of a number that's already in a container. It affects numbers only when they are calculated and then displayed or used as strings. Otherwise, the number retains its full numeric precision.
this means that the numberformat goes into effect if you do some mathematical operation on the number. It is ok to just add 0 to a number for the numberformat to work.

So
set the numberformat to "##.00"
put 1 into myVariable

does not change the numberformat
but
set the numberformat to "##.00"
put 1 + 0 into myVariable
sets the numberformat.

I would not put the formatting into the field, it can be done but there are many things to consider.
Do the formatting in the script before putting the value into the field.
If you want to make shure a manual input into a field is a number then you can go for the keydown. But you would put into a closefield handler and an exitfield handler a script that tests for number, does an arithmetic operation on that number (like add 0) and put the formatted number back into the field.
Still I would suggest that for the dollar sign you make a field (label field) left of the actual value field with just a dollar sign in it. It will be a lot easier for you to use the value of the field later on.
Technically it is not a big deal to check for the dollar sign in the value field but that is something for the bright times when you are more familiar with the documentation and worked your way through the example stacks. :)

regards
bernd

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Thu Mar 12, 2009 1:46 pm

sorry bn
but i do not understand what you are trying to explain to me (sorry me really really simple minded)
now in my "fields" that i use to put in numbers, i have this in the handler
on keydown theKey

if theKey is a number then pass keydown
else if theKey is "." then pass keydown

end keydown
in my total "button" i have this
on mouseUp
set the numberformat to "##.00"
put value ( field "TEntries" + field "StableFee" + field "GroundFee" + field "InsFee" + field "HelpFee" + field "AnyFee") into field "TotalFee"

end mouseUp
then in my balance button i have
on mouseUp
set the numberformat to "###.00"

put value (fld "TotalFee" - fld "APaid") into fld "Balance"
get field "Balance"
if it > 0 then
put it into fld "Ostanding"
else
put it into fld "Credit"
end if
if it > 0 then
put 0 into field "credit"
else
put 0 into field "Ostanding"
end if


end mouseUp
so you can see i have still not worked out how to put the dollar signs in lol
i hope this explains better what i am trying to do,
thanks you for replying bn,
is there anyway you could explain that differently for me to understand ??

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Thu Mar 12, 2009 2:05 pm

What Bernd is saying is that it would be easier to leave the $ sign out of the field and just have the numbers in it. Put a label field containing only the "$" sign next to the field. It will look just as clear, and won't interfere with the numeric value in the field itself.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Thu Mar 12, 2009 2:27 pm

hi smash,
put this into your balance button

Code: Select all

on mouseUp
    set the numberformat to "0.00" 
    put value (fld "TotalFee" - fld "APaid") into fld "Balance" 
    get field "Balance" 
    if it > 0 then 
        put it into fld "Ostanding"
        put 0 + 0 into field "Credit"
    else 
        put abs (it) into fld "Credit"
        put 0 + 0 into field "Ostanding"
    end if 
end mouseUp
It should work, the other two snippets should work too, is that so?
Note I changed the numberformat, the one I gave before does not format it correctly.
regards
bernd

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Thu Mar 12, 2009 10:27 pm

ahhh sparkout you have a way with words lol
now that i understand lol

bn
now the script you gave me for my balance button worked FANTASTICALLY

but the new script puts a minus symbol in my credit figures.
so when the information is transfered to another page, it could get a bit confusing if the credits have a negitive sign in front of them
(am i making any sense?)

thank you all for all your help, you guys are just a breath of fresh air.
THANK YOU

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Fri Mar 13, 2009 12:23 am

Hi smash,

thanks.

For the negativ value in credit:
your script said
put value (fld "TotalFee" - fld "APaid") into fld "Balance"
I didn't change that at all. If the totalFee is less then APaid then you get a negativ number.
I am not good at accounting so maybe you just tell me what you expect in the fields if
a) totalFee is 10 and APaid is 25
b) totalFee is 100 and APaid is 25

what should be in field balance, credit and Ostanding?

I will adjust it then
regards
bernd

Post Reply