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

Primary tabs

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

Answers

I'm not that java guy, so just a hint only.

There should be a

public static java.lang.String PetNameLogicalToDisplay(...)

method, so use/call this method to display your pets.

Thanks for your reply Julius,

But the getPet() is accessing the DB query using SpringBoot. The findAll() method return only  List type not String type.

So, do you have any other ideas.  If yes, Please let me know.

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.