2012
Views
18
Comments
How to convert a text to Entity identifier
Question

Hi,

I have value of type Text and I would like to convert to an Entity Identifier (Order Identifier).

How to do this?Any help appreciated?

 

Rank: #275

Use TextToIdentifier() function


Rank: #275

No. TextToIdentifier converts it to a numeric identifier not a text identifier. I am assuming your order identifier is a numeric identifier. a numeric identifier is basically a long integer. 

e.g. let's say you have a text "1234" and want to store it in a variable OrderId of type Order Identifier

in your assign action you assign TextToIdentifier("1234") to OrderId


mvp_badge
MVP
Rank: #48

Anurag,


you need to convert TexttoLongInteger() or TexttoInteger() and after that LongIntegerToIdentifier() ou IntegertoIdentifier()

E.g  IntegertoIdentifier(TexttoInteger("1234")) or LongIntegertoIdentifier(TexttoLongInteger("1234"))

Use accordingly your Order Identifier ( LongInteger or Integer)


  

mvp_badge
MVP
Rank: #2

Hi Nuno,

What exactly are you trying to convert to what? Is the identifier an Integer, Long Integer or Text? If Integer or Long Integer, why are you trying to compare it to a Text variable?

Hi Kilian, so I understand this is an warning that is happening in version 11 and in previous ones never happened, to do the direct conversion of an Identifier to a text. The warning that appears is that like only works with two texts, and the id although it is text in the query is with identifier.

mvp_badge
MVP
Rank: #2

Hi Nuno,

Since you didn't directly answer my questions, a last attempt to get this clear: can you provide a screen shot of both the Expression and the error message, so I can see what goes on?

mvp_badge
MVP
Rank: #2

Hi Jaret,

What is your problem exactly? Can you show what comparison you do, and what warning message you get?


Rank: #327

Maybe I have the same problem. I am consuming REST API providing objects from external DB. object id is type of text, so when I am synchronizing data to Outsystems entities, I use Id type of text also there. For me it seems, that True change is assuming Entity id to be type of identifier. I tried several conversion functions (Like first converting textTointeger and then integer to identifier) without luck getting True change happy. (See bank account Id details in pic. There are also other similar warnings)
Code is working fine, I'd like True change to be happy without hiding warnings. How to achieve that?

TextEntityProblem.jpg

Rank: #274

According to the documentation, TextToIdentifier should do the trick. 


Rank: #274

TextToTextIdentifier() does that exist? I can't seem to find it anywhere and Service Studio doesn't recognize it either.

Rank: #129

Hi,


Like Fábio mentioned, if you're trying to convert a Text to an Id of type Integer you need to:

  • Convert text to integer or long integer and then to identifier, so something like this IntegerToIdentifier(TextToInteger(<textValue>);

If you're trying to convert a Text to an Id of type Text you only need to apply TextToIdentifier(<textValue>).


If you do this, the warnings will go away because you're assigning integer identifiers to integer identifiers and text identifiers to text identifiers.


Cheers,

João


mvp_badge
MVP
Rank: #2

I think TextToTextIdentifier() is what it was called pre-Platform 10. They simplified the names a bit.

Rank: #327

Ofcourse, thanks!