if/else value reset..
i don’t know what reason
this code.
topic: ~MONGOCOUNSELOR keep repeat [WSMSG:OPEN]
t: (WSMSG:OPEN _*1) ^keep()
$cust=‘_0
$$jsonobject=^jsoncreate(object)
if (^mongoinit(mongodb://localhost:27017 test articles)) {}
else {init failed - $$mongo_error}
if (^mongofinddocument($cust)) {
$mongodata=^mongofinddocument($cust)
$$jsonstring = ^jsonparse($mongodata)
$$custname = ^jsonpath(.name $$jsonstring)
$$custphone = ^jsonpath(.phone $$jsonstring)
$$custaddr = ^jsonpath(.addr $$jsonstring )
^mongoclose()
^jsonobjectinsert($$jsonobject name $custname)
^jsonobjectinsert($$jsonobject phone $custphone)
^jsonobjectinsert($$jsonobject addr $custaddr)
^mongoinit(mongodb://localhost:27017 test buy)
$mongodata=^mongofinddocument($cust)
$$jsonstring = ^jsonparse($mongodata)
$$product1 = ^jsonpath(.product1 $$jsonstring )
$$product2 = ^jsonpath(.product2 $$jsonstring )
^mongoclose()
# name: $$custname /phone: $$custphone /addr: $$custaddr /product1: $$product1 /product2: $$product2 ////
^jsonobjectinsert($$jsonobject product1 $product1)
^jsonobjectinsert($$jsonobject product2 $product2)
}
else
{^mongoclose()}
if ($$custname) {
$$custname hello. your product is ^join($$product1 ?)
name: $$custname /phone: $$custphone /addr: $$custaddr /product1: $$product1 /product2: $$product2 ////
}
else{
hello. what is your name?
name: $$custname /phone: $$custphone /addr: $$custaddr /product1: $$product1 /product2: $$product2 ////
}
a:(~no)your product is ^join($$product2 ?)
name: $$custname /phone: $$custphone /addr: $$custaddr /product1: $$product1 /product2: $$product2 ////