Check if a value listed in entity attribute

Hello All,

i have an entity named "Codes" and this entity has one attribute named "Barcode".

A form displayed to user to fill the his/her input with the format xxxx-xxxx-xxxx-xxxx where the xxxx is the barcode number. So, in Barcode attribute will be saved the user input with the format xxxx-xxxx-xxxx etc

I want to check if the user input (xxxx-xxxx-xxxx etc) is already present in "Barcode" attribute and if yes, then a message will be displayed.

Any advise or suggestion?

Hi George,


You can create a action for that and make as function like CheckExistingBarcode and take one input paramater for UserBarcode and Return true or false . Check UserBarcode with Aggregate where you store this barcode, if aggregate return empty list than return True or not empty return False that code matched.

Hope this will help you

Regards

Rahul Sahu

Hello George,

Please follow the suggestion of Rahul. I think in your case you need to use "like" operator to search the barcode on the Table, right?

BR,

Luis

You can do one of two things, of course, or compare it with a LIKE as Luís suggests, or use one of the text extension functions for example or a built-in function to remove the "-" between the xxxx, and if it's just numbers you can convert it to integer and compare. Another solution that I remembered now, is to use the compare function, which if equal returns true, if there is any difference, returns false.

Cheers,

Miguel

How can i remove the symbol "-" in order to list all the values in a list and to check every value that exists to the additional entity attribute?

George Mitsiou wrote:

How can i remove the symbol "-" in order to list all the values in a list and to check every value that exists to the additional entity attribute?

Hi George,


You can use REPLACE function to remove "-". Here's some examples:


Replace("First string", "xx", "") = "First string"
Replace("First string", "First", "Second") = "Second string"
Replace("First string", "First", "") = " string"

You can see more regarding text treatment here:


https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Text#Replace

Solution

You can use it!

Solution

George Mitsiou wrote:

How can i remove the symbol "-" in order to list all the values in a list and to check every value that exists to the additional entity attribute?

Hi George,

You can use the OutSystems String_Split function, to split on "-" the result will be a list of text attributes.

This you can then iterate for validation. You can also inspect the list count to see if you have the correct number of text fragments.

Regards,

Daniel

Daniël Kuhlmann wrote:

George Mitsiou wrote:

How can i remove the symbol "-" in order to list all the values in a list and to check every value that exists to the additional entity attribute?

Hi George,

You can use the OutSystems String_Split function, to split on "-" the result will be a list of text attributes.

This you can then iterate for validation. You can also inspect the list count to see if you have the correct number of text fragments.

Regards,

Daniel

Thank you All for your replies.


@Daniël Kuhlmann can you provide an example oml in order to get you about the functionality ? It is the first time that i will create this and i am not so aware of.


George Mitsiou wrote:

Daniël Kuhlmann wrote:

George Mitsiou wrote:

How can i remove the symbol "-" in order to list all the values in a list and to check every value that exists to the additional entity attribute?

Hi George,

You can use the OutSystems String_Split function, to split on "-" the result will be a list of text attributes.

This you can then iterate for validation. You can also inspect the list count to see if you have the correct number of text fragments.

Regards,

Daniel

Thank you All for your replies.


@Daniël Kuhlmann can you provide an example oml in order to get you about the functionality ? It is the first time that i will create this and i am not so aware of.


I can if you have patience. Busy with my day-job for now. Will see if I have time in the evening.

But just add the dependency to the Text API and try to use the String_Split version. Just try. All I did to become an OutSystems developers is learn, try, fail, and learn again.

Regards,

Daniel


Miguel Verdasca wrote:

You can use it!

Did you try my solution?
You just need use the function Regex_Replace, like I show you in this screenshots.