I've been asked to create a script that checks if an attribute is a DXL attribute (uses DXL to get the value) and displays the code of that attribute. I've created scripts that use the values of an attribute. However, I'm unsure of how to access the code that creates an attribute's value(s). For example, we have a module that displays a list of modules with another attribute that gets and displays the baselines for that module. The attribute that shows the baselines uses DXL code to get the values and display them. Can someone please steer me in the right direction on how to access a DXL attribute and get to the code behind this attribute?
Chris chrscote - Wed Nov 22 12:30:17 EST 2017 |
Re: Retrieving code from DXL attribute (if it exists) (AttrDef).dxl has two flavors. when used in bool context, it tells you whether the attribute is a DXL attribute or not. when used in string context, it gives you the dxl code
AttrDef ad = find (current, "myAttribute") bool isDXLAttriute = ad.dxl string dxlCode = ad.dxl if isDXLAttribute then print dxlCode
|
Re: Retrieving code from DXL attribute (if it exists) Thank you Mike. That works great!! Now I have another related question... is it possible to get the attribute definition from a prior baseline? In other words, in the first line of code you gave me, can I place the name of a previous baseline (like "1.2 Ready for QA Review")? Or can I only get the definition from the Current baseline? My supervisor would like to, if possible, view the DXL code that was used in a previous baseline to compare it with what is currently in the attribute if something gets messed up in the database for any reason.
Chris |
Re: Retrieving code from DXL attribute (if it exists) chrscote - Mon Nov 27 12:38:40 EST 2017 Thank you Mike. That works great!! Now I have another related question... is it possible to get the attribute definition from a prior baseline? In other words, in the first line of code you gave me, can I place the name of a previous baseline (like "1.2 Ready for QA Review")? Or can I only get the definition from the Current baseline? My supervisor would like to, if possible, view the DXL code that was used in a previous baseline to compare it with what is currently in the attribute if something gets messed up in the database for any reason.
Chris Hi Chris, Sorry, I did not see your reply. Of course, you can load any baseline to get its module handle. See Chapter 16 of the DXL manual "Baselines" Declaration Module load([Module m,] Baseline b, bool display) Operation Loads baseline b of module m; and if the last argument is on or true, displays it. If the first argument is omitted, it uses the current module. Example This example loads baseline 1.0 (without a suffix) of the current module, without displaying it. load(baseline(1,0,null), false)
Edit: Oops, this question was from Nov 2017 not Nov 2018, so, I'm sure that by now you already found the answer yourself.... |