on 01-04-2010 8:31 AM
Hi,
In my ADOBE form, i have a field called Name inside a Table . At runtime i need to change the value of field from, lets say 'Blue' to 'Green'. I have tried using the replace statement against the field Name as follows :
Replace("Blue", "Blue", "Green")
This does not work.
Can anyone suggest how to use Replace statement for Tables fields ?
Thanks
Aditi
In the initialize event of the table you can write following JavaScript code:-
Table1.Row1.Name.rawValue = "Green";
// Assuming Table1 is tablename, Row1 is the row where you have a field called Name
Chintan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chintan,
Thanks for your promt reply. My scenario is like this:
The field Name value is getting populated dynamically in the form .it is having have multiple values like this:
White
Grey
Purple
Blue
Black
Here I need to replace Blue value with Green value. wouldnt there be any looping required in the table ?
Thanks
Aditi
Can't the value "Green" be passed from backend since you do are not changing this in front end (Adobe) based on some condition?
Anyways YES you will need to do looping if you have a dynamic table and do not know the no. of rows at designtime.
For exact code on looping check Pradeep's reply here -->
Chintan
The backend solution (ABAP coding) is the best possibility, SAP recommends doing it this way (me too) bevause the script won´t slow down the form performance itself. Of course you can do this through scripting using Chintans example of code (Table1.Row1.Name.rawValue = "Green";).
You would place a script in the subform event initialize, the subform is the row subform/ parent of the field of the field you need to change. I would use JavaScript. I would use code like this:
if (this.fieldWithYourColors.rawValue == "Green) this.fieldWithYourColors.rawValue = "Red"; ("this" means the row subform)
or you´d better create a scripting object, create a function there and call it from the event like: scoReplace.replace(this.fieldWithYourColors, "Green", "Red"); where scoReplace is the name of your custom scripting object and in the body of the function you place the above line of code, only the values are taken from the passed variables.
Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, how did you solve the problem? Maybe you can share the solution with us? Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Otto,
I did manage to resolve this, but not through scripting . I had to make changes at the interface level itself as the scipting was not working for this issue.Following was the sample code written in Interface using fieldsymbol
loop at it_itab assigning <fs> where colour = 'Blue'
<fs>-colour = 'Green'.
endloop.
Do let me know if u had similar issue and u were able to get it right with scripting.
Regards
Aditi
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.