below is my coding..
so far, the coding can be run, but now i want to upgrade the program so that after the user enter the table, the user can manipulate the data in the table to create a logical explanation from the table
for instance, the default logic that will be created from 3 rows of table is
"1 AND 2 AND 3 AND "
i want to change if user click the checkbox of any data in the table, then if they click on the or selection,the data would change like ( according to the checked checkbox)
--assuming the data checked is 1 & 2
1 OR 2 AND 3 AND
--assuming the data checked is 1,2,3
(1 OR 2 OR 3) AND
--assuming the data checked is 1 & 3
(1 AND 2) OR 3 AND
P:S the brackets will be auto added according to the or selected.
Please anyone who can help me, i really need the solution for this problem..

been doing it for ages now, still cannot solve it..

(
rule = new Array(5);
//todo: find how to replace this implementation
for (i=0;i<100;i++)
{
rule[i] = new Array(3);
}
var last_row = 0;
var vcount =1;
function insert_new_rule()
{
txt = document.forms[0].selTerms.options[ document.forms[0].selTerms.selectedIndex ].text
txt2 = document.forms[0].selConds.options[ document.forms[0].selConds.selectedIndex ].text
txt3 = document.forms[0].txtValue.value
//alert (txt);
var x=document.getElementById('tblRule').insertRow(1)
var w=x.insertCell(0)
var v=x.insertCell(1)
var y=x.insertCell(2)
var z=x.insertCell(3)
var a=x.insertCell(4)
w.innerHTML="<input type=checkbox name=checkbox onclick=test() value="+vcount+">"
v.innerHTML=vcount
y.innerHTML=txt
z.innerHTML=txt2
a.innerHTML=txt3
newvcount = vcount++
countAND = " AND "
count=document.forms[0].txtLogic.value
count=count + newvcount + countAND
document.forms[0].txtLogic.value=count
}
|
|
|
|
|
|
|
Terms |
Conditions |
Value |
|
|
|
Please Choose Service_Number Dialed_Digits To_Number Country_Code Charge Call_Duration Equipment_Num User_Group Pin_Number |
is is not |
|
|
|
|
|
|
|
|
|
|
|
RULE NO FIELD CONDITION VALUE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Comments
rule[0][0][1..3]OR
rule[0][1][1..3]OR
rule[0][2][1..3]AND
rule[1][0][1..3]OR
rule[1][1][1..3]AND
rule[2][0][1..3]AND
the logic should read a null as indication to perform ANDoperation, and increment the 3rd while reset the 2nd index... of course there will be regrouping as elements get shifted(during btnORselection event) to different pages - they should be removed from the previous page.
Good Luck[/green]
: below is my coding..
: so far, the coding can be run, but now i want to upgrade the program so that after the user enter the table, the user can manipulate the data in the table to create a logical explanation from the table
: for instance, the default logic that will be created from 3 rows of table is
:
: "1 AND 2 AND 3 AND "
: i want to change if user click the checkbox of any data in the table, then if they click on the or selection,the data would change like ( according to the checked checkbox)
:
: --assuming the data checked is 1 & 2
: 1 OR 2 AND 3 AND
:
: --assuming the data checked is 1,2,3
: (1 OR 2 OR 3) AND
:
: --assuming the data checked is 1 & 3
: (1 AND 2) OR 3 AND
:
: P:S the brackets will be auto added according to the or selected.
: Please anyone who can help me, i really need the solution for this problem..
:
:
:
:
:
:
:
:
:
: rule = new Array(5);
: //todo: find how to replace this implementation
:
: for (i=0;i<100;i++)
: {
: rule[i] = new Array(3);
: }
: var last_row = 0;
: var vcount =1;
:
: function insert_new_rule()
: {
: txt = document.forms[0].selTerms.options[ document.forms[0].selTerms.selectedIndex ].text
: txt2 = document.forms[0].selConds.options[ document.forms[0].selConds.selectedIndex ].text
: txt3 = document.forms[0].txtValue.value
: //alert (txt);
:
: var x=document.getElementById('tblRule').insertRow(1)
: var w=x.insertCell(0)
: var v=x.insertCell(1)
: var y=x.insertCell(2)
: var z=x.insertCell(3)
: var a=x.insertCell(4)
: w.innerHTML="<input type=checkbox name=checkbox onclick=test() value="+vcount+">"
: v.innerHTML=vcount
: y.innerHTML=txt
: z.innerHTML=txt2
: a.innerHTML=txt3
:
: newvcount = vcount++
: countAND = " AND "
:
: count=document.forms[0].txtLogic.value
:
: count=count + newvcount + countAND
:
: document.forms[0].txtLogic.value=count
: }
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
: Please Choose
: Service_Number
: Dialed_Digits
: To_Number
: Country_Code
: Charge
: Call_Duration
: Equipment_Num
: User_Group
: Pin_Number
:
: is
: is not
:
:
:
:
:
:
: RULE NO
: FIELD
: CONDITION
: VALUE
:
:
:
:
:
:
:
:
:
:
:
:
: