I would like in SAP SAC Script to change the width of a panel to 1/10 of its original…
- User
I would like in SAP SAC Script to change the width of a panel to 1/10 of its original width. I am trying to use this code: for (var r = 0;r<AllShrinkPanels.length;r++){ AllShrinkPanels[r].getLayout().getWidth() / 10; }
but i get automatische konvertierung wird nicht unterstützt
Assistant
The error occurs because you need to:
- Capture the calculated width and
- Set the new width using the proper format (with units)
Here's the corrected code:
javascriptfor (var r = 0; r < AllShrinkPanels.length; r++) { var layout = AllShrinkPanels[r].getLayout(); var currentWidth = layout.getWidth(); // Get current width (e.g., "100px") var newWidth = parseFloat(currentWidth) / 10; // Convert to number and divide layout.setWidth(newWidth + "px"); // Set new width with 'px' suffix }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.