Input Question
11-17-2017, 09:16 AM
Post: #1
 Onieh Junior Member Posts: 34 Joined: Mar 2017
Input Question
How do I read the previous ones in a new input query for this exaple?

EXPORT erfAs()

BEGIN

LOCAL Md,H1,b,∅Bew,∅Büg,d,as;
LOCAL cnom;
LOCAL m,m1,mx,my;

IF I==I THEN Md:=Md;H1:=H1;

INPUT({{Md,[0],{25,15,0}},
{H1,[0],{25,15,1}},
{b,[0],{25,15,2}},
{cnom,[0],{72,15,0}},
{∅Büg,[0],{72,15,1}},
{∅Bew,[0],{72,15,2}}},
"Beton-Querkraftwiderstand",
{"Md [kNm]","h [mm] ","b [mm] ","cnom [mm] ","∅Büg [mm]","∅Bew [mm]"},
{"Bemessungsmoment","Höhe des Betonquerschnittes","breite des Betonquerschnittes","Betondeckung [mm]","Bügeldurchmesser [mm]","Bewehrungsdurchmesser [mm]"});

d:=H1-cnom-∅Büg-∅Bew;
as:=Md*1000000/(0.9*d*435);
END;

RECT_P(7,135,310,200,RGB(0,0,0),RGB(0,230,255));

TEXTOUT_P("Ergebniss: ",19,140,6);
//LINE_P(0,185,170,185);

TEXTOUT_P("erf As",120,140,6);
TEXTOUT_P("=",180,140,6);
TEXTOUT_P(ROUND(as,0)+" mm²",195,140,6);
//TEXTOUT_P("mm",240,140,6);

REPEAT

// Get mouse data
REPEAT
m:=MOUSE; m1:=m(1);
UNTIL SIZE(m1)>0;
mx:=m1(1); my:=m1(2);

// ENDE
IF (my≥220 AND my≤319) AND (mx≥0 AND mx≤51) THEN
Startview(-1);
END;

IF (my≥220 AND my≤319) AND (mx≥106 AND mx≤160) THEN
I:=1;erfAs;
END;

//erfAs neu
IF (my≥220 AND my≤319) AND (mx≥265 AND mx≤319) THEN
I:=1;erfAs;
END;

//Close main loop
UNTIL ((my≥220 AND my≤319) AND (mx≥0 AND mx≤51) or (my≥220 AND my≤319) AND (mx≥106 AND mx≤160) or (my≥220 AND my≤319) AND (mx≥265 AND mx≤319));

END;
11-17-2017, 09:24 AM
Post: #2
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: Input Question
You need to be more explicit about what you are trying to figure out...
11-17-2017, 09:41 AM
Post: #3
 Onieh Junior Member Posts: 34 Joined: Mar 2017
RE: Input Question
(11-17-2017 09:24 AM)webmasterpdx Wrote:  You need to be more explicit about what you are trying to figure out...

I enter in this program my values ​​and let calculate the result. Repeat the input with (zurück) but would like to read in all previous input values, because I only want to change one value
11-17-2017, 10:23 AM
Post: #4
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: Input Question
You can make the variables globals. Make sure you don't use the standard system variable names (try to use unique names).
The variables Md, H1, etc, are all declared as LOCAL inside the function. Instead declare them as EXPORT outside the function (before the function erfAs).
It should just hold the values.

Now, I just tried it on a simple example and it worked. However, if you specify initial values in your input statements, the initial values will override the variable values.

Give it a try.
-Donald
11-17-2017, 11:01 AM
Post: #5
 Onieh Junior Member Posts: 34 Joined: Mar 2017
RE: Input Question
(11-17-2017 10:23 AM)webmasterpdx Wrote:  You can make the variables globals. Make sure you don't use the standard system variable names (try to use unique names).
The variables Md, H1, etc, are all declared as LOCAL inside the function. Instead declare them as EXPORT outside the function (before the function erfAs).
It should just hold the values.

Now, I just tried it on a simple example and it worked. However, if you specify initial values in your input statements, the initial values will override the variable values.

Give it a try.
-Donald

Hello Donald,

can you make a example i my programm?
11-17-2017, 11:11 AM (This post was last modified: 11-17-2017 11:12 AM by webmasterpdx.)
Post: #6
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: Input Question
EXPORT Md,H1,b,∅Bew,∅Büg,cnom; // May need to change b to b1 or something unique
// if you do, change b below too...
EXPORT erfAs()

BEGIN

LOCAL d,as;
LOCAL m,m1,mx,my;

IF I==I THEN Md:=Md;H1:=H1;

INPUT({{Md,[0],{25,15,0}},
{H1,[0],{25,15,1}},
{b,[0],{25,15,2}},
{cnom,[0],{72,15,0}},
{∅Büg,[0],{72,15,1}},
{∅Bew,[0],{72,15,2}}},
"Beton-Querkraftwiderstand",
{"Md [kNm]","h [mm] ","b [mm] ","cnom [mm] ","∅Büg [mm]","∅Bew [mm]"},
{"Bemessungsmoment","Höhe des Betonquerschnittes","breite des Betonquerschnittes","Betondeckung [mm]","Bügeldurchmesser [mm]","Bewehrungsdurchmesser [mm]"});

d:=H1-cnom-∅Büg-∅Bew;
as:=Md*1000000/(0.9*d*435);
END;

RECT_P(7,135,310,200,RGB(0,0,0),RGB(0,230,255));

TEXTOUT_P("Ergebniss: ",19,140,6);
//LINE_P(0,185,170,185);

TEXTOUT_P("erf As",120,140,6);
TEXTOUT_P("=",180,140,6);
TEXTOUT_P(ROUND(as,0)+" mm²",195,140,6);
//TEXTOUT_P("mm",240,140,6);

REPEAT

// Get mouse data
REPEAT
m:=MOUSE; m1:=m(1);
UNTIL SIZE(m1)>0;
mx:=m1(1); my:=m1(2);

// ENDE
IF (my≥220 AND my≤319) AND (mx≥0 AND mx≤51) THEN
Startview(-1);
END;

IF (my≥220 AND my≤319) AND (mx≥106 AND mx≤160) THEN
I:=1;erfAs;
END;

//erfAs neu
IF (my≥220 AND my≤319) AND (mx≥265 AND mx≤319) THEN
I:=1;erfAs;
END;

//Close main loop
UNTIL ((my≥220 AND my≤319) AND (mx≥0 AND mx≤51) or (my≥220 AND my≤319) AND (mx≥106 AND mx≤160) or (my≥220 AND my≤319) AND (mx≥265 AND mx≤319));

END;
11-17-2017, 11:29 AM
Post: #7
 Onieh Junior Member Posts: 34 Joined: Mar 2017
RE: Input Question
(11-17-2017 11:11 AM)webmasterpdx Wrote:  EXPORT Md,H1,b,∅Bew,∅Büg,cnom; // May need to change b to b1 or something unique
// if you do, change b below too...
EXPORT erfAs()

BEGIN

LOCAL d,as;
LOCAL m,m1,mx,my;

IF I==I THEN Md:=Md;H1:=H1;

INPUT({{Md,[0],{25,15,0}},
{H1,[0],{25,15,1}},
{b,[0],{25,15,2}},
{cnom,[0],{72,15,0}},
{∅Büg,[0],{72,15,1}},
{∅Bew,[0],{72,15,2}}},
"Beton-Querkraftwiderstand",
{"Md [kNm]","h [mm] ","b [mm] ","cnom [mm] ","∅Büg [mm]","∅Bew [mm]"},
{"Bemessungsmoment","Höhe des Betonquerschnittes","breite des Betonquerschnittes","Betondeckung [mm]","Bügeldurchmesser [mm]","Bewehrungsdurchmesser [mm]"});

d:=H1-cnom-∅Büg-∅Bew;
as:=Md*1000000/(0.9*d*435);
END;

RECT_P(7,135,310,200,RGB(0,0,0),RGB(0,230,255));

TEXTOUT_P("Ergebniss: ",19,140,6);
//LINE_P(0,185,170,185);

TEXTOUT_P("erf As",120,140,6);
TEXTOUT_P("=",180,140,6);
TEXTOUT_P(ROUND(as,0)+" mm²",195,140,6);
//TEXTOUT_P("mm",240,140,6);

REPEAT

// Get mouse data
REPEAT
m:=MOUSE; m1:=m(1);
UNTIL SIZE(m1)>0;
mx:=m1(1); my:=m1(2);

// ENDE
IF (my≥220 AND my≤319) AND (mx≥0 AND mx≤51) THEN
Startview(-1);
END;

IF (my≥220 AND my≤319) AND (mx≥106 AND mx≤160) THEN
I:=1;erfAs;
END;

//erfAs neu
IF (my≥220 AND my≤319) AND (mx≥265 AND mx≤319) THEN
I:=1;erfAs;
END;

//Close main loop
UNTIL ((my≥220 AND my≤319) AND (mx≥0 AND mx≤51) or (my≥220 AND my≤319) AND (mx≥106 AND mx≤160) or (my≥220 AND my≤319) AND (mx≥265 AND mx≤319));

END;

When i make that, i become a syntax error in this line: EXPORT Md,H1,b,∅Bew,∅Büg,cnom;
11-17-2017, 11:59 AM (This post was last modified: 11-17-2017 12:00 PM by Didier Lachieze.)
Post: #8
 Didier Lachieze Senior Member Posts: 1,648 Joined: Dec 2013
RE: Input Question
I take a look at your program and if I don't understand all you want to do I noticed that you have a recursive call to erfAs as well as a call to Startview(-1) which I don't think are necessary.
So I modified a little bit your code to follow the sequence:

Main Loop:
-Input form to get variable values
-Calculation and display of result
-Wait until user press a soft key
Exit loop if soft key is "ENDE" or "weiter", else loop

If soft key is Weiter, do what you need for Weiter
If soft key is ENDE, do what you need for ENDE

Code:
 EXPORT erfAs() BEGIN   LOCAL Md,H1,b,∅Bew,∅Büg,d,as;   LOCAL cnom;   LOCAL m,m1,mx,my;   LOCAL Ende, Weiter, Zurück;   //Main loop   REPEAT     INPUT({{Md,[0],{25,15,0}},     {H1,[0],{25,15,1}},     {b,[0],{25,15,2}},     {cnom,[0],{72,15,0}},     {∅Büg,[0],{72,15,1}},     {∅Bew,[0],{72,15,2}}},     "Beton-Querkraftwiderstand",     {"Md [kNm]","h [mm] ","b [mm] ","cnom [mm] ","∅Büg [mm]","∅Bew [mm]"},     {"Bemessungsmoment","Höhe des Betonquerschnittes","breite des Betonquerschnittes","Betondeckung [mm]","Bügeldurchmesser [mm]","Bewehrungsdurchmesser [mm]"});     d:=H1-cnom-∅Büg-∅Bew;     as:=Md*1000000/(0.9*d*435);     RECT_P(7,135,310,200,RGB(0,0,0),RGB(0,230,255));        TEXTOUT_P("Ergebniss: ",19,140,6);     //LINE_P(0,185,170,185);     TEXTOUT_P("erf As",120,140,6);     TEXTOUT_P("=",180,140,6);     TEXTOUT_P(ROUND(as,0)+" mm²",195,140,6);     //TEXTOUT_P("mm",240,140,6);     DRAWMENU("ENDE","","weiter","","","zurück");     REPEAT       // Get mouse data       REPEAT         m:=MOUSE; m1:=m(1);       UNTIL SIZE(m1)>0;       mx:=m1(1); my:=m1(2);       Ende:=(my≥220 AND my≤319) AND (mx≥0 AND mx≤51);       Weiter:=(my≥220 AND my≤319) AND (mx≥106 AND mx≤160);       Zurück:=(my≥220 AND my≤319) AND (mx≥265 AND mx≤319);     UNTIL (Ende or Weiter or Zurück); // wait for a soft key   UNTIL (Ende or Weiter); // exit Main loop with "ENDE" or "weiter"   // weiter   IF Weiter THEN     //do what you need for weiter   END;   // ENDE   IF Ende THEN     //do what you need for ENDE   END; END;
11-17-2017, 12:00 PM
Post: #9
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: Input Question
When you run it or when you compile it, and when you click on check, it should place the cursor where the error is.
I'm guessing, but did you remove the LOCAL declarations I moved to EXPORT?
Also, you might need to change the b variable name as I said in the comment....that could be the culprit. You can confirm this by using the check button and seeing where the cursor goes on error.
If this is the problem it's because b already exists as a global variable of a different type....which is why you need to change the name. Remember to change it where it's used in the function too.
11-17-2017, 12:06 PM
Post: #10
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: Input Question
Statistics 1Var uses H1, so that's a problem. You'll have to change H1 to HH1 and change where it's used below to HH1 too.
All the variables need to be unique and not used elsewhere in the system.
11-17-2017, 12:10 PM
Post: #11
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: Input Question
Yes, I change H1 to HH1 on my virtual prime and it compiled fine.....b was OK on my system, but I don't know what programs you have already installed.
11-17-2017, 12:37 PM
Post: #12
 Onieh Junior Member Posts: 34 Joined: Mar 2017
RE: Input Question
Many thanks Webmasterpdx and Didier Lachieze, You hit the nail on the head, that's exactly what I wanted, great.

And sorry, but my englisch is not so good.
 « Next Oldest | Next Newest »