cancel
Showing results for 
Search instead for 
Did you mean: 

Hide a Field in Repeating Subform ??

Former Member
0 Kudos

Hi Experts

I ve created a Purchase order which contains a repeating subform. The Subform contain a line item and a delivery Date and tracking number for that line item. What i m trying to achieve is Hide the tracking Number field when there is no data being populated.

Script I am using to do this is form Calc:

if ($record.MAIN.ITEM.DATA[*].BEDNR == null).

then data.MAIN.ItemRow.END.TRACK.presence = "hidden"

endif

The problem i have it works fine with one line item but more line items then one it seems to go wrong. What happens is when there is no data populating in the tracking number binding then all the line items are hidden even if there is tracking number being populated in the second line item.

How can i rectify this issue pls help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Priyanka

thank you for your reply. BEDNR is a binding in the context that pulls in data regarding tracking numbers. Now in my form i have created a repeating subform using textfields. the form is a purchase order and logically there will be more then one line item populated in a real environment. Each line item is allocated a tracking number. The tracking number is pulled in using a binding called BEDNR from the context. the script i have used above in the first post only works for the first line item. If there is more then one line item it will work for the first line item and not the rest. I need to hide the textfield (regarding tracking numbers) when there is no data pulled through or make the textfield visible in the from for each line item that is being populated with a tracking number. not all line items will have a tracking number in a purchase order. that is my requirement.

All suggestions are welcome

Former Member
0 Kudos

Hi Mahesh,

If you want to access the nth record of a table or table binding, you can do it using a FOR loop as given above.

Can I have your e-mail ID?

Regards,

Priyanka

Former Member
0 Kudos

The problem has been solved by putting simple piece of script as suggested by Priyanka.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Priyanka

thank you for your reply. My requirement is that i am using a text field called BEDNR from the context that pulls in data regarding tracking numbers for a purchase order.

There is a lable called tracking number next to that text field which is a in a repeating subfrorm. I have used the script that i have stated above in my forst post but only works fine if there is one line item. if there are more than one line item it does not seem to work. Suppose there are 10 line items in the purchase order if the first line item has no tracking number then the field will dissappear for the first line item and the other 9 line items too even if there is tracking number allocated to those line items. You are right the script only works for the first line item.

how can i solve this issue?

point will be rewarded

Former Member
0 Kudos

Hi Mahesh,

I understood your requirment. I tried to prototype your issue and solve.

Here am suggesting an alternate solution which might solve your issue.

as per your requirment you have a repeating subform, which has got a number of fields, and you want to hide the tracking number text where "BEDNR" is blank.

Add one more field (say field_1 ) in you table ITEM.DATA[*] in the driver program and populate it with a default value say "Tracking Number".

now you have a table with one more field added in it, that has got value "Tracking Number" in all the line items.

now use the following logic in the Formcalc, form:ready event (on the element field_1)

var i

var j

var record_count = $record.ITEM.DATA.all.length

j = ( record_count - 1 )

for i = 0 upto j step 1 do

if ( $record.ITEM.DATA<i>.BEDNR == NULL ) then

$record.ITEM.DATA<i>.field_1 = " "

endif

endfor

the above logic will not hide the field_1 but it will make this blank.

Hope it helps.

Warm regards,

Priyanka

Edited by: Priyanka Gupta on Oct 7, 2008 1:10 PM

Former Member
0 Kudos

Hi Mahesh,

The condition you are giving,

if ($record.MAIN.ITEM.DATA[*].BEDNR == null). will pick up the very first record of the table.

you can use a FOR loop to satisfy your requirement.

Though am bit unclear about your requirment. As I understand, you have a field called BEDNR in a table and if for each record in table, this field doesn't have any value, you want some other field "tracking number" which is not a part of the same table to be hidden OR you want that complete row of the table to be hidden.

Please clarify.

Warm regards,

Priyanka

Former Member
0 Kudos

Hi Sankar

thank you for your reply. I am not using webdyn pro. I am using a Adobe live cycle which is embedded in SAP ERD system and all the data is being pulled through from data structures that are within the context from the interface.

sankar_narayana
Active Participant
0 Kudos

Hi,

When you are dealing with presence of a Subform means you need to make the form dynamic.

Make the form dynamic and let us know.

If you are using Webdynpro Java write these two lines of code in the "domodifyview" of where you created UI Element of Interactive Form

To make the form dynamic try to write the code in the domodify method of your view where you create the child as Interactive Form

public static void wdDoModifyView()

{

IWDInteractiveForm iForm1 = (IWDInteractiveForm) view.getElement("FormName");

iForm1.setDynamicPDF(true);

}