Skip to main content
Solved

Default Values in combination with functions.


Forum|alt.badge.img+11
  • Hero (Partner)
  • 100 replies

Hi,

 

Was trying out the default value from page designs. Rebate Type is a text field. According to the documentation functions are supported. So my idea was to automatically generate a key. by concatenating the RB_ with the number of records (2) + 1. Expectation would be that RB_3 is generated. But it's just giving back the text. 

 

As the documentation mentions https://docs.ifs.com/techdocs/24r2/040_tailoring/225_configuration/200_client_configurations/330_conditional_default_values/#attributes_of_default_value_case_items “The expression that determines the field's value. This value can either be a hard-coded value, a reference to another field, a CSV value or an expression that returns a value compatible with the field's data type. For details about the expression syntax, see Condition Syntax.”

i also tried just using the function; count(["*"]). Expecting a 2. But also just the text ‘count(["*"])’ is shown. Also #TODAY# gives back the text ‘#TODAY#’ instead of the date. 
 

Am i doing something wrong? Or is this not supported?

Best answer by Rukmal Fernando

@MiLeNL the syntax for text fields is slightly different - see https://docs.ifs.com/techdocs/24r2/040_tailoring/225_configuration/200_client_configurations/330_conditional_default_values/#text

Anything you enter is treated as a literal, which is why you see what you type coming back. If you want to have a literal string and a function, the right syntax is something like: RB_${count(RebateType)}

However, this too will not work in your case because the “context” of the expression is the current row that you’re creating, so you cannot do a count on a row, and what you’re seeking to do is not directly supported.

Perhaps you can try creating a Custom Field that is calculated via a PL\SQL block to have the next sequence value (assume it’s called CF_RebateTypeCount), then you might be able to do something like RB_${CF_RebateTypeCount}.

I haven’t tried it myself though, so not 100% sure if it will work.

Best regards,

Rukmal

View original

7 replies

Rukmal Fernando
Superhero (Employee)
Forum|alt.badge.img+16
  • Superhero (Employee)
  • 381 replies
  • Answer
  • March 4, 2025

@MiLeNL the syntax for text fields is slightly different - see https://docs.ifs.com/techdocs/24r2/040_tailoring/225_configuration/200_client_configurations/330_conditional_default_values/#text

Anything you enter is treated as a literal, which is why you see what you type coming back. If you want to have a literal string and a function, the right syntax is something like: RB_${count(RebateType)}

However, this too will not work in your case because the “context” of the expression is the current row that you’re creating, so you cannot do a count on a row, and what you’re seeking to do is not directly supported.

Perhaps you can try creating a Custom Field that is calculated via a PL\SQL block to have the next sequence value (assume it’s called CF_RebateTypeCount), then you might be able to do something like RB_${CF_RebateTypeCount}.

I haven’t tried it myself though, so not 100% sure if it will work.

Best regards,

Rukmal


Forum|alt.badge.img+11
  • Author
  • Hero (Partner)
  • 100 replies
  • March 4, 2025
Rukmal Fernando wrote:

@MiLeNL the syntax for text fields is slightly different - see https://docs.ifs.com/techdocs/24r2/040_tailoring/225_configuration/200_client_configurations/330_conditional_default_values/#text

Anything you enter is treated as a literal, which is why you see what you type coming back. If you want to have a literal string and a function, the right syntax is something like: RB_${count(RebateType)}

However, this too will not work in your case because the “context” of the expression is the current row that you’re creating, so you cannot do a count on a row, and what you’re seeking to do is not directly supported.

Perhaps you can try creating a Custom Field that is calculated via a PL\SQL block to have the next sequence value (assume it’s called CF_RebateTypeCount), then you might be able to do something like RB_${CF_RebateTypeCount}.

I haven’t tried it myself though, so not 100% sure if it will work.

Best regards,

Rukmal

Hi Rukmal,

 

Thanks for the quick reply. It's a shame it's not working as i intended to do it. But makes sense as well. Was hoping to make it work without a Custom Attribute. However your suggestion did work :-).

 

Created a Custom Attribute which selects the nextval of a sequence. Calling that in the RebateType Default Value will generate the value.

 

It also helps to provide the right syntax, thanks for that as well!

 

Regards,

Mitchel


Rukmal Fernando
Superhero (Employee)
Forum|alt.badge.img+16

@MiLeNL great to hear and thanks for sharing the solution!

Best regards,

Rukmal


PhillBronson
Hero (Customer)
Forum|alt.badge.img+10
  • Hero (Customer)
  • 109 replies
  • March 4, 2025

@Rukmal Fernando good to see that is possible in 24R2.

 

@MiLeNL in previous versions of cloud we accomplished this with a workflow


Forum|alt.badge.img+11
  • Author
  • Hero (Partner)
  • 100 replies
  • March 4, 2025
PhillBronson wrote:

@Rukmal Fernando good to see that is possible in 24R2.

 

@MiLeNL in previous versions of cloud we accomplished this with a workflow

As far as i'm aware workflow never had the capability to set default values for values which are not updateable . Hence it never worked for setting up default key values. Reference topic;  https://community.ifs.com/framework%2Dexperience%2Dinfrastructure%2Dcloud%2Dintegration%2Ddev%2Dtools%2D50/pre%2Dfilling%2Dof%2Dvalues%2Dwith%2Dbpa%2D36748 

Or was this solved in later versions?

 

With the page designer it now is possible.


PhillBronson
Hero (Customer)
Forum|alt.badge.img+10
  • Hero (Customer)
  • 109 replies
  • March 4, 2025

@Rukmal Fernando you’re correct, I missed that detail. Thanks for the clarification!


Rukmal Fernando
Superhero (Employee)
Forum|alt.badge.img+16

@PhillBronson it was ​@MiLeNL who made that last clarification 😉


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings