Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to show only part of a text in a lasso field??

Featured Replies

Hi All.

I'm having a small problem with showing only part of a text on a lasso-page.

I have a database with a field that contains quite a lot of text. I would like to only show the first 40-50 words and then a link to view the hole text on another page. Like most news pages that shows only a part of the news text and then a link to read more. Haven't been able to get it to work.

Have never worked with the strings tag (witch I think is the one to use but I'm not sure) Can anyone help?

Thanks in advance...

The Dog

Edited by Guest

To show the first part of the text, create a calculation field.

To get the first 50 words, the formula is:

LeftWords(textfield;50)

To get just the paragraphs within the first 50 words:

LeftValues(textfield;PatternCount(LeftWords(textfield;50);¶))

To get the sentences within the first 50 words:

Left(textfield;Position(textfield;".";1;PatternCount(LeftWords(textfield;50);".")))

  • Author

Thanks dwins

But the method you outlined takes a database change and an update of the databases. And everytime I have to change anything in the databases I have to pay about 200 dollars to my host... So if anyone knows how to do this in the lasso file (I know it possible) I would be very greatful.

The Dog

Woof! I'm afraid I don't have Lasso and you can already see similar logic w/dwins calc field suggestion, but in PHP it'd be something like....

$article = "[Field:fullstory]";

$intro = substr("$article", 0, 250);

print ("$intro... ");

print ("[MORE]");

I haven't done this; it's only what I think I'd try, so I cannot vouch for it. Plus, I'd be limiting based on 250 characters instead of 40-50 words, but I suppose I could count spaces and use another function. Try to use this kind of logic to the Lasso equivalent. Or post the Lasso info and syntax on the Lasso strings tags and I or someone else can do better.

Lasso should have something like [Left(field:fullstory, 0, 250)] or somesuch similar. Or maybe one of the Lasso folks will jump in here and just say, "Oh, that's easy... it's just...".

--ST

Edited by Guest
missing ' in code

  • Author

Hi Steve

Thanks for your tips.

It helped my get to this:

[var: 'newsString' = (field: 'text', -EncodeBreak)]

[($newsString)->(substring: 1, 300)]

And shows only the first 300 lettes of the text.

That fine.... but I would love to be able to cut the text after a word count not based on letters as it cuts the text (sometimes) in the middle of a word.

Thanks again

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.