on 10-30-2013 9:40 AM
Hi all,
Need your help with that. I´m working on a print Formular, where I have a "for" condition, which should work over all rows in my table. Unfortunately it only checks the first row and after that the condition stops working.
Here is my code
var lang = data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA.all.length;
for (var i=0; i<=lang; i++){
if (data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA.LART_TXT.rawValue != "FRZ")
{
data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA.KOSTL.presence = "invisible"
data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA.ENAME.presence = "invisible"
} }
And this is what I get out of it:
Normally the third row should be looking like the first one.
I already checked, if I get the right length back and this is working fine.
So could you please help me here?
Thanks a lot in advance!
Hello Lisa,
The code provided by you always checks for only the first instance of the record because there is no way you can provide the index at the design level. So do not traverse the node starting from DATA. Do it at the record instance level. Because here you are sure that the code will trigger for each record.
Write the below Java script code on the ENAME of DATA subform and KOSTL field of DATA subform in the Initialize event. This will work.
1) ENAME of DATA subform
if ( this.parent.LART_TXT.rawvalue != "FRZ" )
{
this.presence = "hidden";
}
2) KOSTL of DATA subform
if ( this.parent.LART_TXT.rawvalue != "FRZ" )
{
this.presence = "hidden";
}
Note : Both fields will have the same code. The only difference is that the 1st THIS refers to ENAME field of current row and 2nd THIS refers to KOSTL field of current row.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Prabhu,
i have an other question coming up this morning.
Do you know if i can verify the cell within a second table?
E.g. there is a second table "data.TABELLE.Tabelle2.TAB2.DATA.WHATEVER" and depending on the values in my first table i Need to have other values within the "whatever" field.
How can i link the LART_TXT field into it?
Something like this?:
if ( this.parent.data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA.LART_TXT.rawvalue != "FRZ" )
{
this.presence = "hidden";
}
Hello Lisa,
According to my knowledge, It is very tedious to change the value of a record of one table depending on the value of a record of another table. This is because when you declare two different tables, these 2 tables will be binded in different sub forms unless you have declared them as nested tables. Its a greedy algorithm implemented straight away. 2nd sub form will start processing only after 1st sub form processing has ended. So you have to make use of something called Instance manager of Java script where in for 1st record of 1st table, you have to get instance of 1st record of 2nd table and check the values of LART_TXT (LART_TXT should be present in both the tables) and then modify the value. But these instances need to be stored somewhere so that while processing 2nd sub form it picks up these updated values.
I suggest you to do this modification in the Form Interface using ABAP.
Hi Lisa
The problem may be in the 'if' statement, you are not refering to the row with index 'i'
it should be something like this:
if(data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA[i].LART_TXT.rawValue != "FRZ")
(Notice addition in red)
Regards
Shai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately when I insert your change it showes nothing invisible at all.
So it´s not going through the condtition i guess...
To give you a better perspective of my Environment:
- working with LC Version 8.2
- unsing Java Script
- code is placed within the initialize view
- into the cell data.TABELLE.TabelleA.TAB1.IT_LEISTUNGSDATEN.DATA.LART_TXT
Any other idea?
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.