Best practice to show custom fields on dynpro? - user-interface

I am assigned to implement new custom fields. The possible entries have to be selected from a value table. The value table holds the key and a explaning text. The dynpro is build like that:
Input for new field (zzfield) | Output-only field for explaining text. (zzfield_text)
What I want my dynpro to do:
a) Show text in output field based on entered key
b) Update text after ENTER/SAVE from user
c) Update text directly after a new key has been selected from the value table
My current solution is this:
" in the dynpro
PROCESS BEFORE OUTPUT.
MODULE GET_ZZFIELD_TEXT.
" in the module
DATA: zzfield_text TYPE string.
SELECT SINGLE text
FROM value_table
INTO zzfield_text
WHERE zzfield = mara-zzfield.
This works well for the cases a) and b) I have listed above. However, beeing in a PBO, it does not work for case c). My colleage suggested to use something like this:
" in the dynpro
PROCESS AFTER INPUT.
field: zzfield MODULE get_zzfield_text_pai ON REQUEST.
I can not duplicate my code in the module get_zzfield_text_pai, because the of the DATA declaration of zzfield_text. It is reported to be unknown in the PAI (besides it is already defined in the PBO module) but it is also reported to be duplicated if I declare it again in the PAI. Further, I dont know how to implement new global fields into my function group. Using another include creates again issues of that zzfield_text beeing unknown.
In general, I am not happy about my solution and would be very thankfull for each suggestion about how to code this feature.

Related

ODI KM Option - value from FLEX FIELD

Do you think that it's possible to take a value into an ODI IKM Option (for example) from a flexfield?
Example:
You define a flex field on the target table and then pass the value in the IKM.
Then, reading the variable, it's possible to pass it to an option from the IKM?
Thanks,
After searching I found that it's not possible to do it. Conditional Expression can take predefined values. You can find in the next all the combinations:
Condition Expression – It allows you to set the required condition for
the selected option. Double-click the field for editing the condition
expression for the selected option. Click the browse icon Browse icon,
to launch the Edit Expression Editor, which enables you to create or
edit the existing groovy script that determines whether a knowledge
module should be enabled, disabled, displayed or hidden.
Examples are:
return
options.getValue("Cache").equals("true")?"show=true,enable=true":"show=false,enable=false";
This looks at the value of another KM Option called "Cache". If its
value is "false," then the KM Option is hidden, because it's not
relevant.
return
(isStreaming)?"show=false,enable=false":"show=true,enable=true";
This looks at the Mapping isStreaming property. If it's true, then
this option is hidden.
source
It is very easy to do.
You may use odiRef.getTable(java.lang.String pProperty) in the code of your IKM. One of possible values for pProperty is the code of your FlexField.
If you like to pass if through the option just pas <?…?>-substitution as a value of the option. (Probable you should play with %- or ?-substitutions, which is working.)
Refer to «Substitution API Reference» on Oracle site. Many functions like getTable, getIndex, getAK, getContext and others can obtain flexField value of an object of the corresponding type.
Additionally there is the odiRef.getFlexFieldValue() method. It gets the value of any object of any type, but it is required to pass internal IDs as an argument. So it is not convenient.

OBIEE 12C: use of presentation variables

I have a question concerning the use of presentation variables:
1) What's the correct syntax for filtering on a presentation variable is used? You allow a user to select multiple values in a filter eg. A and B. If you use the syntax = '#{PV}{%}' it will result in this sql: = 'A, B' which of course won't exist in the data. I'd like to have this result: in ('A', 'B').
I've already found this syntax: (#{PV}['#']) which gives the correct sql, only thing here is that this doesn't work when you have a dashboard prompt where you allow 'all column values'. When no value is passed to this presentation variable, the analysis throws an error. I have no idea how to put a default value in this one. Any ideas on this?
2) Is there any configuration or setting where you can push obi to use a presentation variable in stead of using the 'normal' way of filtering as shown here:
The obi way is that it changes the relation to the relation in the prompt (if the prompt says 'is greater than' it will change here as well, even though you've put here 'is equal to'), but it will also use a value for this dimension if there's ever been a value for this, rather than listening to the value in the presentation variable of the dashboard prompt. I know that you can translate this to SQL but that's not the way to go for me. The behaviour I'd like is (in this exact order):
- when there is a value in the presentation variable in the dashboard prompt, take this.
- when there is a value for this role of the dimension, take that.
The reason why is because we have this dimension 'Afdeling' which can take up many roles but our customer asked for the roles to be hidden from the end user. This means that even though you switch roles, the end user always sees 'Afdeling' and couldn't care less in which role it is looking at its 'Afdeling'. They can switch between different dashboard pages and if I'd put on top of the page the dashboardprompt of the 'Afdeling' in the role it needed to be, the value won't pass through when switching pages to another dashboardprompt of another role. That way the end user would know something was up. So the value needs to pass through the prompt on each page, no matter what the role of that dimension.
After a bit of googling I've found the answer to question 1 myself. Thanks to this website https://www.obieetips.com/2014/05/obiee-11g-using-multiple-value-for.html I now know that the correct syntax is (#{pv_region}['#']{'West '})

Odoo 8 "message_id" column in "mail_message" table

I was writing an external app in python that uses the message system in odoo.
So, I need to use, the mail_message, and the mail_notification tables.
I tried to put elements individually via INSERT into the table filling the necessary elements to make this work, and it works perfectly, the messages appear in the "inbox" of messages in Odoo and the notification appears correctly.
But checking the rest of the fields in this table, I see that message_id got a tag format (between <>) and a series of numbers (that I haven't found any correlation) followed by "-openerp-'res_id'-'model'-#'company'".
So, I don't know how to fill this field, my proofs determined that is not a necessary field, but in a serious implementation I don't know if left this field empty can cause some issues.
Anyone can explain me the reason of this field and how to fill it?
Thanks
You can check the code in tools/mail.py and do something similar
def generate_tracking_message_id(res_id):
"""Returns a string that can be used in the Message-ID RFC822 header field
Used to track the replies related to a given object thanks to the "In-Reply-To"
or "References" fields that Mail User Agents will set.
"""
try:
rnd = random.SystemRandom().random()
except NotImplementedError:
rnd = random.random()
rndstr = ("%.15f" % rnd)[2:]
return "<%.15f.%s-openerp-%s#%s>" % (time.time(), rndstr, res_id, socket.gethostname())

Access to iterated controls in repeated sections in Orbeon

When setting repeated content in a section in Orbeon each control is repeated and the their names are the same. How do I access the the control from the first, second...etc instance of a control from each iterated section? I'm thinking along the lines of $control-name[instance#] or something similair.
The following works, given this form:
$name[2]: return the second value
string-join($name, ', '): join all values with commas
count($name): return the number of values
See also the relevant documentation.
To access this value in "bind" section, you can use a relative path , like ../name=''.
TO access this value in "body" section, then you can use context()/../name.
If you are trying to make anything different, be more specific and this answer can be edited to be according to what you want.

PowerDesigner - checking whether an Extended Attribute "Redefined" attribute is checked or not - with VBScript

I really need help with this problem, I just cannot figure out. Here's the deal:
Concept
I use Power Designer to design models, which then are imported into a SAS meta server. I would like to write a VBScript that checks my model for errors. SAS uses some attributes, that my PD doesn't have so I have a XEM file attached to my model that contains extended attributes to my tables and columns. I can check my extended attributes for errors except for one possible source of problem. If I open a table and go to Extended Attributes, then there is a column (for all extended attributes) called "R" (right side from the extended attributes "Value" column) which stands for "Redefined" and it's always ticked (true) if I give value to an extended attribute, and always unticks (false) itself if I empty the extended attribute's value. I would like to write a script which checks if an extended attribute has value, but doesn't have the "R" column ticked (true) or the redefined checkbox is ticked, but the extended attribute doesn't have a value.
Question
How can I access the information with VBScript, that a Extended attribute for a table, or column is redefined or not?
Here's the code I use to check the value of extended attributes. I probably just don't understand the object structure of PD and, can't figure out, how to check "R" (redefined), instead of value...
Here's a code I use to get information about Extended Attributes:
For Each ModelExtension In ActiveModel.ExtendedModelDefinitions
For Each ExtAttr in ModelExtension.GetMetaExtensionsForClass(PdPDM.Cls_Column, Cls_ExtendedAttributeTargetItem)
'SASFormat is an extended attribute for columns
If ExtAttr.Name="SASFormat" Then
output ExtAttr.Name
output ExtAttr.ObjectID
output ExtAttr.Model
End if
Next
Next
And this I use to get values of all extended attribute for columns:
For Each Table In ActiveModel.Tables
For Each Column In Table.Columns
'Extended attributes check
For Each ModelExtension In ActiveModel.ExtendedModelDefinitions
For Each ExtAttr in ModelExtension.GetMetaExtensionsForClass(PdPDM.Cls_Column, Cls_ExtendedAttributeTargetItem)
xEAN = ExtAttr.Name
xEAValue = Column.GetExtendedAttributeText(xEAN)
tn=Table.Name
cn=Column.Name
output tn
output cn
output xEAN
output xEAValue
end if
Next
Next
Next
Next
TL;DR
How can I access the information with VBScript, that a Extended attribute for a table, or column is redefined or not?

Resources