cancel
Showing results for 
Search instead for 
Did you mean: 

Count number of Field

Former Member
0 Kudos

Hi Guru,

i am new in sap interactive form. I have a probleme i need to count the number of field. my scenario is offline. The event handler ist the Drapdown list(+,-) . Wenn i choose + , 10 time then the status ok field most be 10 in the subform 2 . Could somebody help me please.

I will be appreciate.

Thanks in advance.

Regards , Ombessa.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mate,

sorry I couldn't get your requirement, can you please explain it more clear,

Thanks,

Sai

Former Member
0 Kudos

Hi sai,

thanks for your input. My scenario is offline and i need to count a number of field in the table. The event handler is the dropdownlist. to trigger the scenario i choise + or - in the dropdown list. When i choise +, that mean that the car is ok and - the car isn't ok. in the another table i have a field with status ok and nicht ok for the cars. I need to know how many car are ok or not ok and i must count and saving that as total in another subform. All those change suppose to do with js.

Thanks in advance.

Regards

Former Member
0 Kudos

Hi,

I hope this will helpful for you

var numField = this.rawValue;

var count = xfa.form.order.page1.flowedSubform.positionedSubform.all.length

var t;

var r=0;

if(count > 1){

for(t = 0; t < count-1; t++){

xfa.form.order.page1.flowedSubform.positionedSubform.instanceManager.removeInstance(1);

}

}

for(t = 0; t<=numField -2; t++){

xfa.form.order.page1.flowedSubform.positionedSubform.instanceManager.addInstance(1);

}

Thanks

Former Member
0 Kudos

Hi Chanshini,

thanks for the input. But i need to count the field not the page. i have this code what did you mean about.

thank.

function checklist(){

if ((carId.rawValue != 0) && (status.rawValue == "(+)"))

{

then ((this.record.carpgroup1[].GRPnr1) == (this.record.cargroup2.DATA[].GRPnr2))&&

((this.record.car2group[].GRPnr2)== this.record.car3group[].GRPnr3))

for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {

nSum += oFields.item(nNodeCount).rawValue;

}

amount.rawValue = nSum;

Former Member
0 Kudos

hi,

I couldn't understand your code..

but his is how it should be...



//dropdown: change event.

if(carId.rawValue != 0 && status.rawValue == "+"){
var okCount = 0;
var nokCount = 0;

for(var i=0;i<table1.nodes.length-1;i++){
	if(xfa.resolveNode("table.datarow["+i+"].statusfield").rawValue == "OK")
		okCount++;
	else
		nokCount++;
}

form1.subform1.nokCars.rawValue = nokCount;
form1.subform1.okCars.rawValue = okCount;
}

of course the code depends on your form structure and should include any validations as such, but in a simple way to explain this is how I do. hope this helps you.

Cheers,

Sai

Former Member
0 Kudos

HI Sai,

thanks for your input. the Dropdown is the event when i choose + then i need to count the field staus ok which all card kat are equal.

Thanks.

Regards

Former Member
0 Kudos

Hi Guru

i have problem with my js code. my scenario is offline interactiv form. I need to have the node of my it. But i receive only 0 as result not the data row. Please could do help me ?

my js code.

var rowIndex = this.parent.index;

xfa.host.messageBox("Index: " + rowIndex);

var theFields = xfa.resolveNodes("xfa.myMainPage.mySubForm.myTable.myRow.DATA[*].idNR");

var aString = "";

var aString = aString + xfa.resolveNode("myMainPage.mySubForm.myTable.myRow["rowIndex"].idnr").rawValue;

var i = 0;

aString = aString + theFields.item(i).rawValue;

xfa.host.messageBox("Wert: " + aString);

var rowIndex = this.parent.index;

xfa.host.messageBox("Index: " + rowIndex);

Thanks in advance.

Regards, ombessa

Edited by: ombessa on Mar 24, 2011 6:22 PM

Edited by: ombessa on Mar 24, 2011 6:23 PM