Distinct SmartObject

  • 4 November 2014
  • 3 replies
  • 2 views

Badge +1

Hi,

 

I have 1 smartObject with the data. Could everyone help me to distinct data in smartObject ?

 

Example, smartObject that I have

 

 Entity, Currency, AlphabeticCode, NumericCode, MinorUnit, IsFundYesNo

ANGOLAKwanzaAOA9732False
ARGENTINAArgentine PesoARS0322False
AUSTRALIAAustralian DollarAUD0362False
CHRISTMAS ISLANDAustralian DollarAUD0362False

 

When I change that smartObject to dropDown List, The format to show in DropDown is.

 

AOA - Kwanza
ARS - Argentine Peso

AUD - Australian Dollar

 

Thanks you,

 

Akawit


3 replies

Badge +10

Hi Akawit,

 

One way of doing this is with a custom stored procedure.

K2's policy is that you cannot store custom stored procedures in the K2 database, so one alternative is to create a blank database and write your stored procedure in there.

Query the smartobject table by using the full table name: eg. [K2].[dbo].[smartobjectname].

In this query do a SELECT DISTINCT to retrieve the data.

Once the stored procedure is complete, add a service instance from the SQL Service pointing to your new database.

Then create a SmartObject from the stored procedure and use this in your drop-down control.

 

The direct select queries to the smartobject data might be frowned upon, but I don't believe there is a better way of accomplishing this at the moment.

 

Hope this helps!

Regards,

JohanL

Badge +1

oh WOW! It's work!!! Thankyou so much @JohanL:D

 

Badge

You can also create a view in SQL server with discint in query and after that create a SmartObject

Reply