Hello all,
I had a fairly simple requirement.
For customer invoice adobe form customer asked me, if an item has anything written in the customer information, then instead of item description, the customer information text should be written on the form when previewing.
This is my code and I am pretty sure it works okay:
var i = this.parent.Cell1.rawValue / 10 - 1; var j = 0; //this.rawValue = xfa.resolveNodes("CustomerInvoice.Item[" + i + "].TextCollection.Text[*].TypeCode").length; var tekstovi = xfa.record.CustomerInvoice.resolveNodes("Item[" + i + "].TextCollection"); var retci3 = tekstovi.length; if ( retci3 > 0 ) { for ( j = 0; j < retci3 ; j++ ) { var typecode = xfa.record.resolveNode("CustomerInvoice.Item[" + i + "].TextCollection.Text[" + j + "].TypeCode").value; if ( typecode == 10024 ) { var tekst = xfa.record.resolveNode("CustomerInvoice.Item[" + i + "].TextCollection.Text[" + j + "].ContentText"); this.rawValue = tekst.value; } } }However, when this code is active I get all sorts of crazy outputs. When there is nothing entered for a certain item, that item would normaly display Description, as intended and as is the binding for that field. But when there is something entered for a ceratin item then nothing would be displayed, just empty cell.I tried a bilion things that didnt work. Then when I was debuging for a thousanth time one of my examples, I noticed that if I put another table and I bind the item text collections then suddenly my code works and everything is displayed.
I just hide the top table which has item->text collection->content and then suddenly my code works, and it is as if finally the notes from the invoices come to the form.
I dont understand the behavior of SAP Business ByDesign and my adobe form in this case. It is as if anything that is not put as binding somewhere on the form will not be able to be read by javascript ? Is this how the forms behave and I only just realised it or is there something specific for this case ?
I need to understand how this thing works for future references and to minimize time lost on such simple things...
Hopefuly someone understands this and can explain, thank you in advance