51
Views
4
Comments
How to compare text then find the different letter/word
Application Type
Traditional Web

Hey everyone
So i have 2 calculated attribute, called Before(Display before value) and After(Display value after change), i use them to display the changes of value. In the code i assign them like this
GetAById.current.list.current.Before = GetAById.current.list.current.Before +NewLine() + value(Apply the same to the After)(So that when the value display, i will have value like this
A
B
C
Every thing is working as expected, the display is like this on the screen
-If add new
A          A
B  ==> B
C          C
            D
-If delete
A            A
B    ==> C
C
But now what i wanted is that for every item it got add or delete, it will display certain text like this
-If add new

A                A
B  ==>       B
C                C
Empty       D 
-If delete
A            A
B    ==> Deleted
C           C
Can someone help me on this? Thank you very much
*Small note:
For easier example: i need to compare them like this
I have a text A like this
ABC
I want to compare the text A to text B, which is this
ABCD
And the output would show D since it's the missing letter.
Or it could show like text A missing D
                                      text B have D compare to A
Thank you very much! 

2021-12-07 07-28-47
Arnold Ayaoan Jr

Hi John,

Can you share a sample OML for clarity and might be able to help you?

Thanks,

Arnold

UserImage.jpg
Long Truong Hoang

Hi Arnold
Unfortunately, i'm currently working on my work environment, therefor i couldn't share the oml.
I have post a new post, hope you can help, the new post would clarify my needs a bit clearer
https://www.outsystems.com/forums/discussion/100715/is-there-a-way-to-compare-2-text-and-find-the-missing-word/ 

2021-12-07 07-28-47
Arnold Ayaoan Jr

Hi John,

Your best option for this is the Forge component shared by Daniël in your first post.

If you cannot use another component in your work environment, I suggest installing the aforementioned component in your personal environment and copying its implementation into your project.

Alternatively, you can use a brute-force method: convert the two strings into lists of characters (using Substr and List_Append), then iterate over the two lists and compare their values based on your iterator.

Thanks,

Arnold

2025-01-09 14-56-57
IQ78

Hi,

Use 

Replace("target",",","','")

Replace("ABCD","ABC","") will result "D"

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