Searching through a document using DXL
A friend of mine with little experience in (Telelogic Doors) DXL was given a problem to search through a document for objects with possible matches of string.
The problem was :
We have 2 attributes: Severity and Likelihood
Please see the table below for their values:
Edit added (Sample):
A sample document looks as follows2) So now if I have a combination like Severity = Negligible AND Likelihood = Improbable, then I want to parse through the document and then try to find all the objects that have these values and display the total number of objects.
3) Then I move to the next combination ex: Severity = Minor Injury AND Likelihood = Unlikely and then display the total objects for this combination.
4) So now I go through all the 25 combinations and display the total for each combination.
Trouble is I have no experience of DXL . I know how to do it in C/C++ but not in DXL.
Need a开发者_如何学运维 DXL based solution to above.
Must you do this in DXL? It may be much easier to do this another way. For example, depending on how the documents are structured, you might be able to create a view categorized by severity and likelihood, and then present totals for each category.
Or you could export the data and calculate the totals easily using a spreadsheet.
UPDATE: DXL is merely a XML format that applies to Domino. So once you have a database in DXL format, you can parse it like any other XML document using C/C++ if you're most comfortable with that. The key to this task, then, is to get the database into a DXL format.
With the Lotus Notes C/C++ API you can create a DXLExport from a NotesSession object, and call into the DXLExporter class to perform the export (excuse me if I'm messing up the object names - I'm used to LotusScript mainly).
Another option that could work for you is to use this DXLExporter Wizard for Domino 8.5. That will take the work out of creating the DXL and you can focus on parsing it instead.
This has nothing to do with Domino DXL, but everything with Telelogic Doors eXtension Language. The documentation: http://publib.boulder.ibm.com/infocenter/rsdp/v1r0m0/index.jsp?topic=/com.ibm.help.download.doors.doc/topics/doors_version9_1.html
Suggestion: remove the lotus-notes tag.
Amitd, the most straight-forward path is to create a view with object heading, object text, severity, likelihood, and any other relevant attributes; then perfom the basic export to Excel. Once in Excel, we'll manipulate the data as required.
Open the exported document, and sort by Severity, then Likelihood. Create the aggregate calculations using the Excel built-in functions: COUNTIF, and Data > GROUP and Data > SUBTOTAL options. You may then sort on the aggregate totals, or filter on the attributes for different combinations.
FYI - DXL is DOORS eXtension Language--nothing to do with Domino.
I know I am a bit late to the party here but what you are looking for is this:
First save your input file as a csv.
Module m = current
Object o
Stream infile = read("PathToYourCsvFile")
string inline = ""
infile >> inline
while(!end(infile))
{
string Severity = ""
string Likelihood = ""
// Here do some code to get the values from the line in the csv
// If you still are interested I can add this in with an update later.
for o in m do
{
if((o."Severity" "" == Severity) && (o."Likelihood" "" == Likelihood))
{
count++;
}
}
infoBox "Severity = " Severity " and Likelihood = " Likelihood " MATCHES: " count ""
}
This will pop up a box after each line is calculated with the number of matches found. You can easily have it just popup one box at the end with all of the matches if you wanted. Again if you are still interested, give me some more info on what you want for inputs and outputs and I can give you more accurate code.
精彩评论