Question about the function RANDOM

Please login to reply  Page: « < 1 of 1 > »
31 Aug 2010 - 14:59738
Question about the function RANDOM

Hello, Please see the sample code i.I use the function random , why its value changes when I input other fields.
May be this is easy, but it is weird for me. I cannot understand the logical.
Thanks.

DATAMODEL TEST_RANDOM
FIELDS
A1 "RANDOM SEED": 1..15
A2 "RANDOM" : 0..14
A3 "SEE RANDOM IS ^A2" :0..1
A4 "SEE A2 CHANGE ^A2" :0..1
A5 "CHANGE" :0..1
RULES
A1
A2.KEEP
A3.KEEP
A4.KEEP
A2:=RANDOM(A1)
A2.SHOW
A3
A4
A5
ENDMODEL



__________________
世界因你我而不同。
31 Aug 2010 - 17:14739
Invoke RANDOM only once

Hello Yushuang,

Try putting in the following syntax in your rules, in order to invoke the RANDOM function only one time.

A2.KEEP

{Other RULES instructions}

IF A2 = EMPTY THEN
A2 := RANDOM(A1)
ENDIF

Yours,

Mark M Pierzchala
MMP Survey Services, LLC



01 Sep 2010 - 11:35741
keep method

Hello Yushuang!
The explanation is in help of Blaise. Imagine, that after changing value of every field in DEP, program begins to do his job on first line of rules of your datamodel (I simlify the manners of Blaise a little). Every field is EMPTY in this case. Fields can get its value throught keep, ask and show method or by mapping, but not by using a field in if then else statement. This is the reason why you observe such manners of Blaise. Sometimes it is good, sometimes it is bad. You have to be familiar with this.



__________________
Mirek

Last edited by blaisemaster (07 Sep 2010 - 12:59)
Please login to reply  Page: « < 1 of 1 > »