Skip to content

Need to truncate a segment #6270

Answered by pacmano1
kgarland9363 asked this question in Q&A
Jul 30, 2024 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

This can be shortened up of course.

var maxLength = 250;
var appendText = "test text some more stuff here";

for each (var allergy in msg.AL1) {
	var this_allergy_desc = allergy['AL1.5']['AL1.5.1'].toString()
	if (this_allergy_desc.length > maxLength) {
	    allergy['AL1.5']['AL1.5.1'] = this_allergy_desc.substring(0, maxLength) + appendText;
	}
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@pacmano1
Comment options

Answer selected by pacmano1
@rjkroll
Comment options

Comment options

You must be logged in to vote
1 reply
@pacmano1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants