26
Views
5
Comments
Setting container width by calculation
Question

Hello all.  In the screenshot you can see a nested container with a width set to 400px.  What I would like to do is dynamically set that container width to either 200px or 400px depending on the length of characters of the expression contained within it.  How can this be done?



Screenshot 2024-09-27 at 2.30.03 PM.png
UserImage.jpg
retkasvb

Hello
You can try create a two classes for both like 

.small-text-container {

    width: 200px;

}

.large-text-container {

    width: 400px;

}

and apply to container attributes as
class = if(Length(expressionValue) > charNum, "large-text-container", "small-text-container")

P.S. I mixed up 'styles' and 'classes' in my explanation 

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @retkasvb ,

you are confounding styles and classes in your reply / example

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi Richard Dwyer,

We can achieve this by using extended property of the container.

By finding length of your expression value we can apply condition in it according to your scenario.

In the OML I did with style, we can do with the class also.

Please find below OML for your reference and any concern let me know.


Regards,

Rajat

TestingDemo.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Rajat Agrawal ,

on the form : 

please say in your post what you are doing in your oml.  The way you are doing it now, you are forcing everybody who reads this post to download and open your OML.

on the content :

inline styles are not a best practice, if you know of better solutions (like in this case with classes) don't propose the lesser solutions.

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi @Dorine Boudry ,

Hope you are doing good.

I also explained in the content and also attached OML if the source wants to check. I am not forcing anyone, just trying to help in the minimum comment. I'll try to keep it as simple as I can going forward. Thank you for the feedback.

Regards,

Rajat

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.