get value from TXDataWebEntityField

Hi i ve a dataset field of type TXDataWebEntityField. How get the value asstring for example ?

You can't, TXDataWebEntityField is supposed to hold a Javascript object. You get the underlying object using the Value property and then you can do properly further processing with it.

can you give me an example ?

What do you want to achieve, exactly?


If you see in the photo i ve cod_set which is a EntityField (that link with wdSett datasetfield) but i want to get the value of this field

As I mentioned, you get the value using the Value property:

var
  CodSet: JSValue;
begin
  CodSet := wdGrpCOD_SET.Value;

when i do this :
var
CodSet: JSValue;
begin
CodSet := wdGrpCOD_SET.Value;
Text:=String(CodSet)+';'+DataSet.FieldByName('Cod_Grp').AsString;

I've a result as [Object];011 BUT must be 001;011

If i try JS.ToString(CodSet) i ve an empty string

What data type do you expect to be in CodSet? Can you please do a console.log(CodSet) and see in browser console exactly what do you get there?

Cod_Set is a simple field that is a foreign key of a master table wdSet that have a string value BUT aurelius put it with a entityfield. I discovered now to get the value must create a special string field named COD_SET.COD_SET to get the value. Its true ?

Yes, that is true. COD_SET is the associated object, it's a Javascript object, as I mentioned. You get the underling object using Value property and then you can do properly further processing with it.

TheCODSETObject := TJSObject(wdGrpCOD_SET.Value);
OnePropertyOfCODSETObject := string(TheCodeSETObject['COD_SET'];