VishalMistry
13th April 2016, 14:50
Hi,
Can anybody guide regarding my following questions:
1. How can we check at run time whether a given field is enum type
2. Is is possible to change data type of any form field (change domain) at runtime ?
Please guide.
Vishal
mark_h
13th April 2016, 15:26
You can always go check the domain type - in 4c4 it is in table ttadv400. I do not know of a way to change the domain of a form field at run time - at least not in 4c4.
mark_h
13th April 2016, 15:28
Forgot about rdi.domain - I think it will work also for finding the domain.
bhushanchanda
13th April 2016, 17:02
Hi,
Why do you need to change the domain? What is the exact requirement? There might be better solutions.
VishalMistry
14th April 2016, 11:03
Hello Bhushan,
I am trying to dynamically add filters to the session that i have just created, which is based on the user selection of fields he wants to include on the form as a selection criteria.
Vishal
sachinbaan
14th April 2016, 13:03
Hi vishal,
rdi.domain() can be used to identify domain type of field.
OR
rdi.column() can be used to identify what type of field is.
OR
there is a function "rdi.domain.enum (string domain_name(14), ref long no_enum_items)",
which returns the information about domain of type enum, it returns 0 for success and 1 for error, so at least you will come to know whether the domain is of type enum or not.
use domainof(field) as first argument of rdi.domain.enum()
hope this will help you... :)
Thanks & Regards,
Sachin
JaapJD
14th April 2016, 13:33
If this is for LN, you have the possibility to create the complete form dynamically. This is called "Programmable Dialogs". See the dialog.* functions in the Programmer's Manual.
mark_h
14th April 2016, 15:32
What I do when I want to add filters to a session I create a filter session. So for example you could run tisfc9190m000 and see all work orders no filtering. But if you tisfc9180m000 then this session lets you enter filters like show me all completed orders for make item 12345. Then this filter session launches tisfc9190m000 as a subsession - because of how it is launched a query extension kicks for tisfc9190 and does the filtering for the user based off what they entered in the filter session. Some cases they always go thru the filter session and can just leave everything blank to see all records. Just depends on the user needs.
Now you can actually build dynamic sql in session tisfc9190 but I do not recommend it. That basically means each time a user hits next record or previous record then you find that record for them rebuilding a query every time. I only have a session like that and it is a bear to maintain. Luckily no changes to the filters in about 10 years or so.
Ishank Mangla
1st October 2016, 09:07
I am getting this- Error: Illegal type combination: 'enum = long'. As i am new to LN, so anybody can help me out ?
sachinbaan
6th October 2016, 06:22
Use enum = ltoe(long)