HyperNext Studio
HyperNext Studio => General => Topic started by: Jeff on January 30, 2011, 11:24:23 PM
-
I have two questions to ask and it is about Adding, Subtracting, Dividing and Multiplying numbers:
Question 1:
How can I Add two(2) different fields(e.g. Add field1 from field2) and get the answer in the third field(field3) just by clicking a button?
All these fields and a button must be in the same card.
What is the code that I will place into this button?
Question 2:
How can I Add two(2) different fields(e.g. Add field1 from field2) and get the answer in the third field(field3) just by clicking a button?
field1 and field2 must be in the same card (card1).
Field3 and the button must be in card2
What is the code that I will place into this button?
I've tried and tried but can't figure it out.
Thanks.
JD
-
I have two questions to ask and it is about Adding, Subtracting, Dividing and Multiplying numbers:
Question 1:
How can I Add two(2) different fields(e.g. Add field1 from field2) and get the answer in the third field(field3) just by clicking a button?
All these fields and a button must be in the same card.
What is the code that I will place into this button?
You have to place each field into variables before you can performs maths with them.
Local a,b
Put field 1 into a
Put field 2 into b
Add a to b
Put b into field 3
For fields on another card - example card 5
Local a,b
Put FieldCardFN(5,1) into a
Put FieldCardFN(5,2) into b
Add a to b
FieldCardSet(5,3,b)
Question 2:
How can I Add two(2) different fields(e.g. Add field1 from field2) and get the answer in the third field(field3) just by clicking a button?
field1 and field2 must be in the same card (card1).
Field3 and the button must be in card2
What is the code that I will place into this button?
Local a,b
Put field 1 into a
Put field 2 into b
Add a to b
FieldCardSet(2,3,b)
-
Sir,
I still can't get the codes right. Everything went right when I start running it, there was no error on the codes.
But when I start inserting the numbers in fields 1 & 2 and clicked the button nothing was showing in field 3.
So this is what I did and please correct me:
In Card1:
I placed 2 fields (fields 1 & 2) and a next button to get me to card 2.
These are the codes I put in fields 1 & 2...
@
Local a,b
Put field 1 into a
Put field 2 into b
Add a to b
Put b into field 3
This is the code button...
@ GotoCard 2
These are the codes I placed in field 3 in card 2....
@
Local a,b
Put FieldCardFN(2,1) into a
Put FieldCardFN(2,2) into b
Add a to b
FieldCardSet(2,3,b)
This is the button that when clicked displays the sum in field 3 in card 2...
@ Add Field 1 to Field 2
Please help, this is how I understand your reply
Thanks
JD
-
I'm sorry - its field 1 in card 2 so the code in the button should be:-
Local a,b
Put field 1 into a
Put field 2 into b
Add a to b
FieldCardSet(2,1,b)
-
Sir,
Field 3 in card 2 showed a zero when I pressed the button
This is the code you gave me to be placed in the button in card 2:
@
Local a,b
Put field 1 into a
Put field 2 into b
Add a to b
FieldCardSet(2,1,b)
Please help, I am really confused now...
Thanks
-
For my test example - they assume that button 1, fields 1 and 2 on are card 1, while field 1 is on card 2.
The syntax for the FieldCardSet(p1,p2,p3) is:-
p1 = card where the field is located
p2 = the target field on that card
p3 = the value to put into target field
Note, the numbering of controls on each card is independent from controls on other cards. So it is possible to have fields on different cards each numbered 1 - the field on card 2 does not have to be numbered 3.
By the way, if the target field does not exist then by default HyperNext does not report an error, the command just fails silently.
-
Sir,
Thank you very much for the codes. After your last post I'm starting to understand the logic behind this. I think HyperNext is the best to use for creating softwares faster.
By the way is it possible to place the value of field1 into field2 in the same card?
I'm trying it but can't figure this out.
Thanks
JD
-
By the way is it possible to place the value of field1 into field2 in the same card?
Yes, just use:-
Put field 1 into field 2