Question

Custom field - select statement with no argument

  • 29 July 2022
  • 5 replies
  • 364 views

Userlevel 1
Badge +1

Hello,

I am trying to create a read-only custom field  which would do the following:
Retrieve the value from a configuration table by using the user’s session ID as condition.

The configuration table’s structure is as follows:
 



I tried to create a read-only field with a select statement but arguments are mandatory.

 


Do you any idea of how to implement this functionality?

Thanks in advance,
Mélanie.


5 replies

Userlevel 6
Badge +14

Hello @MélanieV 

 

Yes, it is mandatory, as the value of the arguments is the variable you need to pass to your query in order to obtain data. It is generally something like this: v.FIELD_NAME_FROM_TABLE from the table where you are creating the custom field.

Based on the screenshot from your example.

Would you like to create the custom field in the table CVE_USER_MAP_CLV?

It would be helpful for me to understand your request in more detail.

You are trying to obtain data for each user who logs into IFS. The best thing I can suggest to you is to create a SQL expression. From your second screenshot, you can see the second option.

 

 

Passing  as an argument FND_Session_api.get_fnd_user() and since you will create this function in a package, it will return data to your custom field.

It would look something like this.

THE_PACKAGE_API.GIVE_ME_WEB_MAP(FND_Session_api.get_fnd_user())

Within your API

In order to build a function, you need

 

FUNCTION GIVE_ME_WEB_MAP (variable  in varchar2) RETURN VARCHAR2 IS

CF$CVE_WEBMAP_ Varchar2(120);

cursor get_user_map is

SELECT CF$CVE_WEBMAP

from CVE_USER_MAP

where CF$_CVE_USER_ID = variable;

begin

   for rec in get_user_map loop

      CF$CVE_WEBMAP_ := rec.CF$CVE_WEBMAP;

   end loop;

return F$CVE_WEBMAP_;

end GIVE_ME_WEB_MAP;

 

In your SQL expression, you will receive the return value from the function GIVE_ME_WEB_MAP

Hopefully, this will be helpful. :-)

 

Thanks 

JL

 

 

Badge +1

I'm especially stayed aware of the article and I will get many benefits from it. Subsequently, thank you for sharing it.  MyAARPMedicare

Userlevel 1
Badge +1

@ZTC ZTC JGOTA ,

Thank you for your reply.

“Would you like to create the custom field in the table CVE_USER_MAP_CLV?”

No, I want to use CVE_USER_MAP_CLV as configuration table where values of USER_ID and  WEBMAP would be saved. Then, I want to create a read-only field on another page which would display the value of the WEBMAP based on the user logged in( user’s session ID).

Example:
 


I want to add a read-only field on the Supplier page for example and if User “MVI” is logged in, the read-only field created should display the value “Test B” .

 




If I understood it well, the solution you have suggested is to create a function inside the API.
However, for this project we are restricted to configurations only. For the moment, development is out of our scope.
Is there another way to create a function through configuration without having to go through development?

Thanks in advance,
Mélanie
 

Userlevel 6
Badge +14

Hello @MélanieV 

 

Could you please send me the all fields name from table CVE_USER_MAP_CLV ?

I want to recreate your example.

 

Thanks,

Juan Luis

Userlevel 1
Badge +1

@ZTC ZTC JGOTA,

There are only two fields in the table CVE_USER_MAP_CLV; USER_ID and WEBMAP.
USER_ID is a reference field of the view FND_USER.

You will find attached the application configuration package containing the entity CVE_USER_MAP_CLV and the page associated to that entity.

Below a screenshot of the page.


 

Thanks,

Mélanie

Reply