Question
· Dec 21, 2019

How to Get the Property's DisplayList data of ValueList from Java

Hi All,

I trying to get the DisplayList data of the ValueLIst from Java using Springboot. when I try to get the DislayList data via java code but I'm getting the VALUELIST data. I don't get any idea to get that DisplayList data. Below is the example

Property PetName As %Integer(DISPLAYLIST = ",Cat,Dog,Dove,Parrot", VALUELIST = ",1,2,3,4");

Java Code:

public String PetName;

public List<Pet> getPet() {
        return ser.findAll();
    }

List<Pet> arrayList = getPet();
        for (Patient list : arrayList) {

                 String pet= list.getPet();

                 System.out.println("Pet Name --->" + pet);

}

If PetName value is 2  I am getting output 2 not "Dog". Which means it return the interger value not the string value. So how to get that. Please help me...

 

 

Thanks,

Vikram

Discussion (4)1
Log in or sign up to continue

You need to tell Springboot to fetch data in display mode or use %EXTERNAL function on column value. That's Java side.

Alternatively, on InterSystems side you can create a calculated property and access it in Java (replace !!! with full class name):

Property PetNameDisplay As %String  [ SqlComputeCode = {##class(!!!).PetNameLogicalToDisplay(##class(!!!).PetNameGetStored({%%ID}))}, SqlComputed, SqlComputeOnChange = (%%INSERT, %%UPDATE) ];

Remove SqlComputeOnChange  and add Calculated if you want it always computed instead of trigger-computed and stored.