Skip to main content
Question

Custom Attribute with select statement


Forum|alt.badge.img+3

Hello everyone.

I am a newbie to IFS hence this is my first question in this forum.

I just want to retrieve the last 3 digits from a column called “Part_No”, I created the flowing inquiry and validated it at the Database layer  

SELECT SUBSTR(Part_No, LENGTH(Part_No)-2) AS Truncated_Part_No
FROM Reserved_Lot_Batch

Unfortunately, I got an error from IFS when I try to save the read only Custom Attribute with select statement. Screenshot below.

 

what is wrong here?

Regards,

5 replies

Forum|alt.badge.img+3
  • Author
  • Sidekick
  • 7 replies
  • April 19, 2023

here is a screenshot from IFS

 


Forum|alt.badge.img+10
  • Hero (Partner)
  • 186 replies
  • April 19, 2023

@akrageb  

 

You are incorrectly assigning the variable part_no,

you should use :part_no (so do not forget the : sign)

 

Here is another example:

 

 

you can find more info here

 

Set Implementation Type (ifs.com)


Forum|alt.badge.img+3
  • Author
  • Sidekick
  • 7 replies
  • April 19, 2023

@kvbe  many thanks for you reply.

 

You are right, I fixed this. The error is gone. Still however not getting my desired result.

The first issue is that instead getting the last 3 digits of part_no, I got the last 6 numbers (see the image below). I need to show only last 3 numbers whether they are digits or letters.

Please notice that the query was validated on the DB.

 

Furthermore, when the “Part_No” is a string or has letter IFS generates an error even though the cast is done using cast(). The error is below

 

{"error":{"code":"DATABASE_ERROR","message":"Database error occurred. Contact administrator.","details":[{"code":6502,"message":"ORA-06502: PL/SQL: numeric or value error: character to number conversion error"}]}}

Forum|alt.badge.img+10
  • Hero (Partner)
  • 186 replies
  • April 20, 2023

@akrageb  make sure after you created your query that you delete the field and recreate it on the field. 

Als I would not do any casting in your query and make sure your custom field is a string. 


Forum|alt.badge.img+3
  • Author
  • Sidekick
  • 7 replies
  • April 21, 2023

Hankx agian @kvbe 

In fact I could understand why I need to recreate the field again and why not casting?

 


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