Powerbuilder Get objects of Nested Datawindows - nested

I have a datawindow dw_1
Inside there are 3 datawindows (nested): dw_1, dw_2, dw_3
I want a way to get the objects of the 3 datawindows.
This does not work (it prompts Incompatible property Object for type datawindowchild) because it is a Nested and not a Composite.
I cannot work out the appropriate dot notation
datawindowchild ldwc_report1
dw_1.GetChild("dw_1",ldwc_report1)
li_col_idx = 1
ls_objects = ldwc_report1.object.datawindow.objects
Thank you in advance!

To naswer my question: Edit Source and set Processing = 5

Related

How to organize a set of similar functions in two parallel chained-classes

I would like to obtain this set of properties with 1 class + 2 chained-classes:
mytable.EntireRange
mytable.DataBodyRange
mytable.HorizontalHeaderRange
mytable.VerticalHeaderRange
mytable.col(strTitle).num
mytable.col(strTitle).firstDataCell
mytable.col(strTitle).lastDataCell
mytable.row(strTitle).num
mytable.row(strTitle).firstDataCell
mytable.row(strTitle).lastDataCell
What's the best way to organize (and name) these classes and properties?
My current solution to add the chained properties is:
- I named the three classes "mytable", "mytable_col", "mytable_row" to keep a visible relationship in the Project Explorer
- inside "mytable", I added this:
Property Get col(strTitle As String) As mytable_col
Set col = New mytable_col
col.Initialize = Me ' passes the parent object
End Property
Property Get row(strTitle As String) As mytable_row
Set row = New mytable_row
row.Initialize = Me ' passes the parent object
End Property
Now... given that the three properties ("num", "firstDataCell", "lastDataCell") of the two parallel chained classes "col" and "row" share the same logic with little variations, I'd prefer to not put their complete code separated in 6 properties, three in the "row" class and three in the "col".
I ideally would to create just 3 properties/functions (passing a "row" or "col" as argument for the variations) instead than six.
How should I do? Is it possible, without to put them in an additional module?

In Spotfire, how to trellis a SummaryTable using IronPython script

I am trying to "trellis" a summary table using a script. The TrellisVisualization is not available for the SummaryTable class. Using the GUI, I can trellis a summary table by assigning a specific column to the Categorization property under Columns Properties. However, while using the IronPython script, I don't see any property named Categorization for the SummaryTable object. So, I tried assigning the column to the CategoryAxis as follows:
mySummaryTable.CategoryAxis = "<[myColumn]>"
But this throws an error:
AttributeError: 'SummaryTable' object has no attribute 'CategoryAxis'
I also tried using Axis or CategoricalAxisBase etc. as properties, but these options did not work out. If anyone has more ideas on this, please let me know. Thanks.
RD
The key issue here is that the CategoryAxis property underneath the Summary Table class is a GET of this visual's object of the GroupByAxis class. You can see this by using the print command and getting information about the object:
print mySummaryTable.CategoryAxis
results in my Spotfire example:
<Spotfire.Dxp.Application.Visuals.GroupByAxis object at 0x000000000000002C [Spotfire.Dxp.Application.Visuals.GroupByAxis]>
You were actually quite close though. In order to set the CategoryAxis you need to set the Expression property of the CategoryAxis like so:
from Spotfire.Dxp.Application.Visuals import SummaryTable
mySummaryTable = myVisual.As[SummaryTable]()
mySummaryTable.CategoryAxis.Expression = "<[COLUMN]>"
If you need to pass an actual column name into that rather than hardcoded, I would concatenate the expression syntax and set the Expression equal to that variable:
myColumnExp = "<[" + myColumnName + "]>"
mySummaryTable.CategoryAxis.Expression = myColumnExp
Please let me know if you need any clarity regarding this. My Spotfire version for this answer is v6.5.2.26 and my API information from https://docs.tibco.com/pub/doc_remote/spotfire/6.5.0/api/Index.aspx

Create a collection of item ids Revit API in Python

So I am trying to use a list of input strings to isolate them in a view using Revit API. I got this far, but I am getting stuck where I am trying to create a set that takes all elements in a view and removes ones that are created from input IDs. I am doing this to end up with a set of all elements except ones that i want to isolate.
dataEnteringNode = IN0
view = IN0
str_ids = IN1
doc = __doc__
collector = FilteredElementCollector(doc, view.Id)
for i in str_ids:
int_id = int(i)
id = ElementId(int_id)
element = doc.GetElement(id)
element_set = ElementSet()
element_set.Insert(element)
elements_to_hide = collector.WhereElementIsNotElementType().Excluding(element_set).ToElements()
#Assign your output to the OUT variable
OUT = elements_to_hide
I would greatly appreciate a help in solving this error. I am getting that "expected ICollection[ElementId], got set". I am guessing the problem lies in a Excluding filter where i need to create a collection of Ids to exclude but I dont know how. Thank you in advance. Thank you for help in advance!
The reason your code doesn't work is that ElementSet in the Revit API does not implement the ICollection<T> interface - just the IEnumerable<T>. So, to get your code working, you will need to create an ICollection<T> object from your set.
Try something like this:
# ...
from System.Collections.Generic import List
element_collection = List[ElementId](element_set)
elements_to_hide = collector.WhereElementIsNotElementType().Excluding(element_collection).ToElements()

Binding an edit box within a custom control to a form field programatically

I have a notes form with a series of fields such as city_1, city_2, city_3 etc.
I have an XPage and on that XPage I have a repeat.
The repeat is based on an array with ten values 1 - 10
var repArray = new Array() ;
for (var i=1;i<=10;i++) {
repArray.push(i) ;
}
return(repArray) ;
Within the repeat I have a custom control which is used to surface the fields city_1 through city_10
The repeat has a custom property docdatasource which is passed in
It also has a string custom property called cityFieldName which is computed using the repeat
collection name so that in the first repeat row it is city_1 and in the second it is city_2 etc..
The editable text field on the custom control is bound using the EL formula
compositeData.docdatasource[compositeData.cityFieldName]
This works fine but each time I add new fields I have to remember to create a new custom property and then a reference to it on the parent page.
I would like to be able to simply compute the data binding such as
compositeData.docdatasource['city_' + indexvar]
where indexvar is a variable representing the current row number.
Is this possible ? I have read that you cannot use '+' in Expression Language.
First: you wouldn't need an array for a counter. Just 10 would do (the number) - repeats 10 times too. But you could build an array of arrays:
var repArray = [];
for (var i=1;i<=10;i++) {
repArray.push(["city","street","zip","country","planet"]) ;
}
return repArray;
then you should be able to use
#{datasource.indexvar[0]}
to bind city,
#{datasource.indexvar[1]}
to bind street. etc.
Carries a little the danger of messing with the sequence of the array, if that's a concern you would need to dig deeper in using an Object here.
compute to javascript and use something like
var viewnam = "#{" + (compositeData.searchVar )+ "}"
return viewnam
make sure this is computed on page load in the custom control
I was never able to do the addition within EL but I have been very successful with simply computing the field names outside the custom control and then passing those values into the custom control.
I can send you some working code if you wish from a presentation I gave.

Cascading list boxes, with multi-select

I wound up modifying the source from a publically posted POC: http://datacogs.com/datablogs/archive/2007/08/26/641.aspx, which is a custom field definition for cascading drop downs. The modifications were to allow parent-child list boxes where a user can multiselect for filtering and selecting the values to be written back to a SharePoint list. I got the parent-child cascading behavior working, but the save operation only takes the first value that is selected from the list box. I changed the base type for the custom field control from "SPFieldText" to "SPMultiLineText", along with changing the FLD_TYPES field definition values from:
Text to Note and this did not work. So, I changed the field control base type to "SPFieldMultiChoice" and the FLD_TYPES to "MultiChoice" and still get the same result, which is only the first value that's selected, writing to the SharePoint list.
Does anyone have any idea how to get a custom field with multiple selections to write those multiple selections to a SharePoint list?
Thanks for taking the time to read through my post.
Cheers,
~Peter
I was able to accomplish this by inheriting from SPFieldLookup and overriding its internal handling of AllowMultipleValues:
In your FLDTYPES_*.xml set <ParentType>LookupMulti</ParentType>
In your extension of SPFieldLookup, be sure to override AllowMultipleValues (always true), FieldValueType (probably typeof(SPFieldLookupValueCollection)) and FieldRenderingControl. I also set base.LookupField = "LinkTitleNoMenu", though in retrospect I'm not sure why. :)
In your field editor control's OnSaveChange(), set the field's Mult value to true.
To set Mult, you can either string manipulation on field.SchemaXml:
string s = field.SchemaXml;
if (s.IndexOf(" Mult=", StringComparison.OrdinalIgnoreCase) < 0)
field.SchemaXml = s.Insert(s.IndexOf("/>", StringComparison.Ordinal), " Mult=\"TRUE\" ");
Or use reflection:
var type = field.GetType();
var mi = type.GetMethod("SetFieldBoolValue", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(field, new object[] { "Mult", true });
It's been a while, so I might be forgetting something, but that should be most of it.

Resources