Datasource + .NET controls - progress-4gl

I am using OpenEdge 10.2B and OpenEdge Architect and I did the following steps:
created a form.
added a .NET grid control and a button that I named gridCustomer and btnProcess.
created a temp table like this:
DEFINE TEMP-TABLE ttCustomer
FIELD CustNo AS CHARACTER
FIELD Name AS CHARACTER
FIELD City AS CHARACTER.
added an event ButtonClick event.
In this event, I am able to populate the temp-table but I could not assign it as a datasource like this:
ASSIGN gridCustomer:DataSource = THIS-OBJECT:ttCustomer.
I get the error message : could not locate element ttCustomer in class.
Is there an example or a documentation somewhere about how to populate a datasource of a .NET control?
Thank you very much!
Sebastien

You have to assign a BindingSource object that points to a buffer, query or prodataset handle:
gridCustomer:DataSource = new Progress.Data.BindingSource(BUFFER ttCustomer:HANDLE).
Look for Progress.Data.BindingSource class in the OpenEdge Help for a detailed explanation.

Related

Report generator only showing names of the objects instead of their content

I have a code generating a full report but I want to add an image in the header so I created a template and tried out. But now the word file only gives me the name of the objects in the report and not the actual content like this:
Do anyone know where does this problem comes from?
My code is
%% init
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Document('Report','docx', 'template.dotx');
moveToNextHole(rpt)
%% chapter
ChapterRegression = Chapter;
ChapterRegression.Title = 'Summary';
append(rpt, ChapterRegression)
close(rpt)
rptview(rpt)
My dotx template just have one Rich Text Content Control hole.
Thank you in advance!
My question has been answered on Mathwork forum. But let me sum it up here as well:
I am using the Document object and we can not add Report API objects like TitlePage to a DOM Document. Instead and that was what I was doing at first I should use mlreportgen.report.Report of the DOM Document. You can add both DOM and Report API objects to a Report object.
Then to use all the functions relative to the Document object like moveToNextHole() the Report object has an underlying DOM Document object that can be used.
Use it like this for example:
doc = rpt.Document;
doc.moveToNextHole();

Worklist template i18n <ObjectName>

Does the <ObjectName> refer to a variable which contains the name of the object? Or should I replace it manually with a suitable name?
The IDE generated #XTIT: Table view title worklistTableTitle=<ObjectName> in i18n.
The line which you have mentioned
#XTIT: Table view title worklistTableTitle=<ObjectName>
This is just a sort of comment in i18n file.
appDescription=<you can fill anything you can here> to reflect in your app.
When you use SAP WebIDE to create a template/application, it may create i18n files with placeholders for you to replace them with your own application specific texts. In your case, in the code below <ObjectName> represents a placeholder for your own text.
#XTIT: Table view title
worklistTableTitle=<ObjectName>
It does not refer to any variable, you simple have to add you own text in that field. Something similar to this :
#XTIT: Table view title
worklistTableTitle=My Products List

How to create a display,or similar, method with paramater?

in my myForm I call in a tableMY a displayMethod_fieldA.
In myForm I insered a some date in a DateEdit and I want to make a selection in table using the entered value. If I crete a displayMethod whit parameter I have an error.
Look like this code I get error:
display myEDTField displayMethod_fieldA (date _dateFromForm)
{
tableMY table;
select table
where table.item == this.item
&& table.dateTable == _dateFromForm;
return table.valueFieldA;
}
I have an error looklike this:
The display method has an incorrect parameter profile.
There is another way to display or set the value in my StrinEdit in Grid by method passing a parameter?
In web I saw the method modifier modifierMothod , but I need some more explanation. I don't know if this method is a right way.
Display methods are not designed with this feature.
display method for a table, form, report, or report design does not
have any parameters. For example: display Amount amount()
A display method for a form data source does require a parameter. You
use the
parameter to specify a table buffer. The type of the table buffer has
to match the type of the table in the form data source.
https://msdn.microsoft.com/en-us/library/aa595058.aspx
You can create the desired behaviour with an edit method (and setting the field to AllowEdit(false) or enabled(false).

enterprise architect api: Add element to a collection

I have few short questions regarding Enterprise architect.
My question is regarding the automation interface. When following the instructions provided on this page: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/colle... in order to add a new element to the collection ( and the .eap file) it does not add the element. I can get data from the elements, modify and even delete them, but adding a new element does not work?
Instructions provided:
Call AddNew to add a new item.
Modify the item as required.
Call Update on the item to save it to the database.
Call Refresh on the collection to include it in the current set.
my java example:
elements is a collection of all the elements in the model...
org.sparx.Element elementEa = elements.AddNew("Requirement", "non-functional");
elementEa.Update();
elements.Refresh();
With the api is it possible to change the id or guid of an element since there are no methods specified in org.sparx for that?
One last thing... Is it possible to create a custom element in EA, for example a requirement which will not have the standard properties like difficulty, priority etc.. , but will have others? (normal properties, not tagged values)
The arguments to AddNew() are Name and Type, so to create a Requirement element you should specify "SomeRequirementName" and "Requirement".
You can't change the ID or GUID through the API, and your models would crash and burn if you did (connectors would be left dangling, elements would vanish from diagrams, etc, etc).
With an MDG Technology you can create very detailed stereotyped elements if you like, with their own visual representations (shape scripts) etc, but if you're after creating an element type with its own properties dialog the answer is no; there is no hook for a custom dialog in the API.
Collection<Package> packageCollection = myPackage.GetPackages();
Package consolidatedCfsSpecPackage = packageCollection.AddNew("somePackageName", "");
if (!consolidatedCfsSpecPackage.Update()) {
System.err.println("Not Updated: somePackageName");
}
packageCollection.Refresh();
This works for me. I suggest you to check return value of elementEa.Update() method you called. If it returns false, you can get the reason by calling elementEa.GetLastError().

How to include view variable inside zend translate expression?

I want to display latest 3 news at my homepage. I select the latest news from table from MySql database and assign them to view variables in index controller, like this:
$this->view->latestNew = $someClass->getNewsfunction();
Then I declare it in view:
echo $this->translate->_($this->latestNew);
assuming that each time I will add a new row in my News table from MySql database, a unique header will be passed to Zend_Translate, which automatically will be detected by Poedit and proposed to be translated. But it won't work. The options like {$this->latestNew}, '$this->latestNew', "$this->latestNew" won't work neither. Any ideas?
One suggestion:
declare a literal to use in poedit and pass a variable as a parameter to it
In your view
printf($this->translate->_("title"), $this->latestNew);
in poEdit
source text: 'title'
translation text: %s
You can translate the content always with poEdit.