cancel
Showing results for 
Search instead for 
Did you mean: 

adobe form first data row of a table in BOLD characters

former_member206721
Participant
0 Kudos


HELLO

I HAVE A REQUIREMENT WHERE THE FIRST ROW OF A TABLE SHOULD BE IN BOLD

basically the fiels are  EBELP  and  mat_desc.

and this is what i see when i  When i point to my data row in the heararchy

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA::ready:form - (JavaScript, client)

 

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP::ready:form - (JavaScript, client)


 

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC::ready:form - (JavaScript, client)

As i dont know too much  on script , if somebody can help me that would be great

thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

pavan_prabhu
Active Participant
0 Kudos

Hello Tahar,

        

          You can achieve this using 2 methods:


1) Using a Global variable in the Layout.

For the First time, this global variable will be blank. If blank, then Set all the fields of a row to "Bold" and set this Global variable to "X". Now the same code will be triggered for next row. So this time,  the fields will not be set to Bold because the Global variable is set. Write the below Javascript code on the Initialize event of DATA sub form as shown below.

if ( data.global_var == " " )

{

     this.EBELP.font.weight = "bold";

     this.MAT_DESC.font.weight = "bold";

     data.global_var = "X";

}

So for next row, the font will not be bold because the Global variable is already set to "X"

2) Using a new Column in the table.

You can create one column in the table called Flag and in ABAP in Form Interface or Driver Program set this column to "X" only in 1st record. Set both the fields to bold only when the Flag column has the value "X". In Layout hide this Flag field. Write the below Javascript code on the Initialize event of DATA sub form as shown below.

if ( this.flag.rawvalue == "X" )

{

     this.EBELP.font.weight = "bold";

     this.MAT_DESC.font.weight = "bold";

}


former_member206721
Participant
0 Kudos

hello

where shod i define my global variable  in the interface initialization ?

pavan_prabhu
Active Participant
0 Kudos

Hello Tahar,

     Not in the Initialization.

    You should define it in the Layout in the Hierarchy tab as shown below. Drag and drop a text field from the Object Library in the layout. Then adjust and bring this under data level as shown below. Finally hide this field. This will be the Global Variable.

    

pavan_prabhu
Active Participant
0 Kudos

Hello Tahar,

     I have tested the 1st method and it works good. Just a small change you need to make from my 1st reply.

Set the Default Value of Global variable to "X" rather than keeping it space. You can set the default value to "X" as shown below.

The Default value (space)  works inconsistently in Javascript. Sometimes isNull will work, sometimes    == " " will work. Sometimes both doesn't work.

So instead of checking the Default value as space, check whether the Default value is "X".

For the First time, this global variable will be "X". If "X", then Set all the fields of a row to "Bold" and then immediately set the Global variable to space i.e " ". Now the same code will get triggered for the next row. So this time,  the fields will not be set to Bold because the Global variable already set to space in 1st row and the IF condition will fail here. This will repeat for rest of the records. Write the below Javascript code on the Initialize event of DATA sub form as shown below.

if ( data.global_var.rawvalue == "X" )

{

     this.EBELP.font.weight = "bold";

     this.MAT_DESC.font.weight = "bold";

     data.global_var.rawvalue = " ";

}



By doing this, only 1st row will be bold as shown below in the sample form. Only first row is bold as shown below.




former_member206721
Participant
0 Kudos

Hello

Actually i changed the logic it is only if  ebelp it is not blank that the line is bold wich will not require q variable definition.

So I put this codfe whih is your code but modified but still not working ??

in initialization  i put  the following

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC::initialize - (JavaScript, client)

      if ( data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP  != " " ) 

{

   data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight         = "bold";

   data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight  = "bold";

}

see attached

pavan_prabhu
Active Participant
0 Kudos

Hello Tahar,

     Try the code with Rawvalue as shown below.

if ( data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.rawvalue  != " " )

{

   data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight         = "bold";

   data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight  = "bold";

}

former_member206721
Participant
0 Kudos

it is still not working i dont know what is missing ?

I even logged off and on to be sure the changes were taken in consideration .


if (data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.rawValue  != " " )

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight     = "bold";

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight  = "bold"; }

pavan_prabhu
Active Participant
0 Kudos

Hello Tahar,

     I think open flower bracket is missing in above code.

    

     Can you please whether it is the same problem. check the syntax on the Javascript where you have written.

Click on the syntax check button highlighted in red above. If there is error, the line with the error will be highlighted.

You can check the error description by clicking on the Palettes button highlighted in blue above. In that select Report button. Let me know if you are getting the error or not.

former_member206721
Participant
0 Kudos

no it is my cut and paste that did not workproperly, i tested as you said and have no red lines

if (data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.rawValue  != " " )

  

{

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight     = "bold";

   data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight  = "bold"; }

pavan_prabhu
Active Participant
0 Kudos

Hello Tahar,

     I found out what the problem is. There were 2 major problems.

1) The condition != " "

2) Traversal of node from data.*

- To solve the 1st problem, you should use

  if ( ! this.EBELP.rawValue.isNull ) instead of

  if ( this.EBELP.rawValue != " " )

- To solve the 2nd problem, write the Java script code on Initialize event directly on DATA sub form as highlighted in the arrow below.

Delete the previous code which was not working. Write the code as below.

if ( ! this.EBELP.rawValue.isNull )

{

  this.EBELP.font.weight = "bold";

  this.MAT_DESC.font.weight = "bold";

}

I have tested it in a test form and it works fine. Find the results below.

Only the 1st, 3rd and 5th rows are Bold because ID field is filled only in these rows.

2nd and 5th row is normal since the ID field is empty here.

former_member206721
Participant
0 Kudos

yes that was it, thanks now it is working but i also did a mistake i should put my code at the data row level not at the ebelp

Answers (2)

Answers (2)

navip
Active Participant
0 Kudos

Select the fields EBELP  and  mat_desc and from the field format select "plain text".

then go to the paragraph format and select "B" for that particular fields("EBELP  and  mat_desc").

---

Naveen

former_member206721
Participant
0 Kudos

this will let all the lines bold  i just want the first line only on bold  i know how to do this

i already gave exacty what i have in my script now

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP::ready:form - (JavaScript, client)

and i wanna put something like

if  data.page2.Sous-formulaire2.ZTMM_EKPO.DATA(1).EBELP    then put cell to bold

navip
Active Participant
0 Kudos

did you achieve your requirement by following the below??

if  data.page2.Sous-formulaire2.ZTMM_EKPO.DATA(1).EBELP    then put cell to bold.


If your requirement is not achieved then separate the 1st line from the table and implement:


Select the fields EBELP  and  mat_desc and from the field format select "plain text".

then go to the paragraph format and select "B" for that particular fields("EBELP  and  mat_desc").

--

Naveen

0 Kudos

hi 

Cell1.font.weight = "bold";

Cell2.font.weight = "bold";

hope it will work

regards

Jitendra.

former_member206721
Participant
0 Kudos

this will let all the lines bold  i just want the first line only on bold

                0001      material 1

                0002      material 2

                0003     material  3

0 Kudos

hi Tahar Yacoub

i have tested the above code that  bolds only first line not all the rows (lines)

i have specified that write code on initialize event of Row1 only and specify the cells that you want to bold.

Regards

Jitendra

former_member206721
Participant
0 Kudos

how do i specify row1  in my case data1   or data(1) ??

my table is   ztmm_ekpo  and row data is   data  and field is  ebelp

data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP::ready:form - (JavaScript, client)

0 Kudos

hi  Tahar Yacoub

write this javascript code on initialize event of DATA

xfa.resolveNodes("DATA[*].EBELP[0]").item(0).font.weight  = "bold";

xfa.resolveNodes("DATA[*].MAT_DESC[0]").item(0).font.weight  = "bold";

hope it will work

regards Jitendra

former_member206721
Participant
0 Kudos

I put the code but still first line is not bold, all table lines are unbold



-formulaire2.ZTMM_EKPO.DATA[*].EBELP[0].font.weight = "bold";





-formulaire2.ZTMM_EKPO.DATA[*].MAT_DESC[0].font.weight = "bold";

0 Kudos

HI tahar

have you written code like i  have written because u didn't use xfa.resolvenode and item(0) in your code

check your code   because i have tested it is working fine and just send the image of your hierarchy..

Regards

Jitendra.