Display number of filitering results sets - emeditor

According to my question
Begin-/Endfilter
Is it possible in EmEditor to display the number of filtered results sets (could be equal to number of lines, if not using the Begin-/Endfilter) in the status bar of EmEditor; i found no options in the settings?

After you filter, how about searching for the end filter with the Count Matches option?
If you use a macro, I added the Find line to the last of the previous macro. You can use this macro instead:
filters = document.filters;
filters.Clear();
filters.AddFind( "|Column1", eeFindReplaceCase, eeExFilterBegin );
filters.AddFind( "| Number of Records:", eeFindReplaceCase, eeExFilterEnd );
document.filters = filters;
document.selection.Find( "| Number of Records: ", eeFindCount | eeFindReplaceCase );
You can run this macro after you open your data file. To do this, save this code as, for instance, Filter.jsee, and then select this file from Select... in the Macros menu. Finally, open your data file, and select Run in the Macros menu while your data file is active.
Before you run this macro, please deselect the Show Execution Time option in the Status page of the Customize dialog box.

Related

UFT - Select File from TreeView

I have recorded a script to Click on an XML file(highlight, right-click and open) from a popup treeview, the popup contains a number of files(varying amounts/types and they can appear in any order), the one I will always want to select always begins with 'AB', the numerics of the filename will change per test however:
SwfWindow("APPMAIN").SwfWindow("2000HOME").SwfTreeView("MainTreeList").SelectCell "AB99872","Object Name"
SwfWindow("APP-MAIN").SwfToolbar("SwfToolbar").Select "Open"
After Recording, I run the script, but I get the following error:
SelectCell :SelectCell :Cannot identify the specified item = AB99872 of the TreeView.
So my question is 2 part:
Why can it not select the file AB99872 after the initial record using SelectCell?
Considering that the filename will change per test(ie... AB*), what is the best way to automate this to be robust enough to select any Filename beginning with 'AB'. I did try UI Automation/Object Recognition and I used a regular expression like ^AB.* but UFT(v12.54) continually crashed with this approach.
You can use the tree's GetContent method and then use regular expressions to find the name of the node to select (then use that value in SelectCell.

SPSS syntax for naming individual analyses in output file outline

I have created syntax in SPSS that gives me 90 separate iterations of general linear model, each with slightly different variations fixed factors and covariates. In the output file, they are all just named as "General Linear Model." I have to then manually rename each analysis in the output, and I want to find syntax that will add a more specific name to each result that will help me identify it out of the other 89 results (e.g. "General Linear Model - Males Only: Mean by Gender w/ Weight covariate").
This is an example of one analysis from the syntax:
USE ALL.
COMPUTE filter_$=(Muscle = "BICEPS" & Subj = "S1" & SMU = 1 ).
VARIABLE LABELS filter_$ 'Muscle = "BICEPS" & Subj = "S1" & SMU = 1 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0). FILTER BY filter_$.
EXECUTE.
GLM Frequency_Wk6 Frequency_Wk9
Frequency_Wk12 Frequency_Wk16
Frequency_Wk20
/WSFACTOR=Time 5 Polynomial
/METHOD=SSTYPE(3)
/PLOT=PROFILE(Time)
/EMMEANS=TABLES(Time)
/CRITERIA=ALPHA(.05)
/WSDESIGN=Time.
I am looking for syntax to add to this that will name this analysis as: "S1, SMU1 BICEPS, GLM" Not to name the whole output file, but each analysis within the output so I don't have to do it one-by-one. I have over 200 iterations at times that come out in a single output file, and renaming them individually within the output file is taking too much time.
Making an assumption that you are exporting the models to Excel (please clarify otherwise).
There is an undocumented command (OUTPUT COMMENT TEXT) that you can utilize here, though there is also a custom extension TEXT also designed to achieve the same but that would need to be explicitly downloaded via:
Utilities-->Extension Bundles-->Download And Install Extension Bundles--->TEXT
You can use OUTPUT COMMENT TEXT to assign a title/descriptive text just before the output of the GLM model (in the example below I have used FREQUENCIES as an example).
get file="C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav".
oms /select all /if commands=['output comment' 'frequencies'] subtypes=['comment' 'frequencies']
/destination format=xlsx outfile='C:\Temp\ExportOutput.xlsx' /tag='ExportOutput'.
output comment text="##Model##: This is a long/descriptive title to help me identify the next model that is to be run - jobcat".
freq jobcat.
output comment text="##Model##: This is a long/descriptive title to help me identify the next model that is to be run - gender".
freq gender.
output comment text="##Model##: This is a long/descriptive title to help me identify the next model that is to be run - minority".
freq minority.
omsend tag=['ExportOutput'].
You could use TITLE command here also but it is limited to only 60 characters.
You would have to change the OMS tags appropriately if using TITLE or TEXT.
Edit:
Given the OP wants to actually add a title to the left hand pane in the output viewer, a solution for this is as follows (credit to Albert-Jan Roskam for the Python code):
First save the python file "editTitles.py" to a valid Python search path (for example (for me anyway): "C:\ProgramData\IBM\SPSS\Statistics\23\extensions")
#editTitles.py
import tempfile, os, sys
import SpssClient
def _titleToPane():
"""See titleToPane(). This function does the actual job"""
outputDoc = SpssClient.GetDesignatedOutputDoc()
outputItemList = outputDoc.GetOutputItems()
textFormat = SpssClient.DocExportFormat.SpssFormatText
filename = tempfile.mktemp() + ".txt"
for index in range(outputItemList.Size()):
outputItem = outputItemList.GetItemAt(index)
if outputItem.GetDescription() == u"Page Title":
outputItem.ExportToDocument(filename, textFormat)
with open(filename) as f:
outputItem.SetDescription(f.read().rstrip())
os.remove(filename)
return outputDoc
def titleToPane(spv=None):
"""Copy the contents of the TITLE command of the designated output document
to the left output viewer pane"""
try:
outputDoc = None
SpssClient.StartClient()
if spv:
SpssClient.OpenOutputDoc(spv)
outputDoc = _titleToPane()
if spv and outputDoc:
outputDoc.SaveAs(spv)
except:
print "Error filling TITLE in Output Viewer [%s]" % sys.exc_info()[1]
finally:
SpssClient.StopClient()
Re-start SPSS Statistics and run below as a test:
get file="C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav".
title="##Model##: jobcat".
freq jobcat.
title="##Model##: gender".
freq gender.
title="##Model##: minority".
freq minority.
begin program.
import editTitles
editTitles.titleToPane()
end program.
The TITLE command will initially add a title to main output viewer (right hand side) but then the python code will transfer that text to the left hand pane output tree structure. As mentioned already, note TITLE is capped to 60 characters only, a warning will be triggered to highlight this also.
This editTitles.py approach is the closest you are going to get to include a descriptive title to identify each model. To replace the actual title "General Linear Model." with a custom title would require scripting knowledge and would involve a lot more code. This is a simpler alternative approach. Python integration required for this to work.
Also consider using:
SPLIT FILE SEPARATE BY <list of filter variables>.
This will automatically produce filter labels in the left hand pane.
This is easy to use for mutually exclusive filters but even if you have overlapping filters you can re-run multiple times (and have filters applied to get as close to your desired set of results).
For example:
get file="C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav".
sort cases by jobcat minority.
split file separate by jobcat minority.
freq educ.
split file off.

How can I use OpenArgs to print multiple reports in a loop situation?

I am slimming down my databases, eliminating duplicate reports where I can and creating better code. I have one database that involves our welders and foremen. In this code, I can print a report for an individual foreman, which sends the string "strActive" through openargs The report looks at strActive and on the OpenForm action, sets the filter for active, inactive, or all welders, based on the string value passed through.
It works perfectly for the single page at a time code. There, the user chooses a foreman from a list or enters the foreman's clock number. The query the report is based on uses the global string "ForemanCLK" to only get results for that welder.
Formerly, I had three reports; one for all welders, one for active welders, and one for inactive welders.
Previously, I would set a variable based on strActive and open the appropriate report using another variable in the code in place of the report name. The loop worked fine and opened the report 39 times, each time with a new foreman name and data.
I'm baffled as to why opening the report now, with an openarg, doesn't work. I only get the first foreman name, 39 times. I've verified that I get the foremanCLK variable of the different foremen by commenting out the docmd line and debug.print(ing) the various values needed by the form. The report simply doesn't load it correctly.
Set rec = CurrentDb.OpenRecordset(sql)
rec.MoveFirst
For ctr = 0 To rec.RecordCount - 1
ForemanCLK = rec(0).Value
DoCmd.OpenReport "rptForeman", acViewNormal, , , , strActive
'DoCmd.OpenReport "rptForeman", acViewNormal
rec.MoveNext
Next
The above code gets me many copies of the same foreman's report filtered by strActive
For ctr = 0 To rec.RecordCount - 1
ForemanCLK = rec(0).Value
'DoCmd.OpenReport "rptForeman", acViewNormal, , , , strActive
DoCmd.OpenReport "rptForeman", acViewNormal
rec.MoveNext
But this gets me all the different foremen, except it is not filtered.
I've tried passing in a Where clause.
acViewNormal, ,"[active]=" & True
and
acViewNormal, ,"[active]=" & False
and
acViewNormal, ,"[active]=" & True & " OR [active]=" & False
I did the same verification with the single report, and it filters correctly, but in the loop, it does not filter at all. It does, however give me the different foremen.
The big question here is...
WHY? Does access not have enough time between reports to close it and therefore it doesn't perform the operations on the open event?
Any other ideas?
You must close the report explicitly inside your loop: DoCmd.Close acReport, "rptForeman". If OpenReport is called a second time on an already-open report, the object gets the focus in access, but it doesn't re-run the Open event.
Okay, I must hang my head in shame.
I error checked the hell out of that code above using every variable except strActive.
When I added that to my debug.print line, it came up with nothing. How can that be!?!!??
I simply forgot to set that at the beginning of the sub, like I did with the other action that opens a single report. strActive is a global variable, but was not set at any other point in the code up until this piece.
Once this was added to the beginning of the sub, all worked fine.

print line before page changed in vfp reports

I'm creating a report in vfp. The report contains grouping. In the end of each group, i draw a line. Each row in the detail band doesn't contain any line, only at the end of each group. The problem is when the group expand to the next page, in the previous page i want to draw a line at the bottom. Like this :
(page 1)
group A
name, etc
x1,etc
x2,etc
???how do I add line here?
(page 2)
group A
name,etc
x3,etc
x4,etc
group B
name,etc
y1,etc
y2,etc
I've tried to place the line in the page footer band, but the last line of the report doesn't have exact position, so it doesn't look nice.
Hope I described the situation clear enough. Thank You for taking the time to help me.
Without some significant smoke-and-mirrors trickery: running the report twice, once hidden and track where the breaks are via function calls in the report, and then again for production, its not EASILY done.
The only thing I could suggest is putting a line at the TOP of a PAGE FOOTER which prints on EVERY page. How long have you been working with VFP. Depending, I MIGHT be able to guide you through it.
Ok, here are the steps I would take. This is under the assumption that you are pre-querying the results for your report and ordering them by some means into a temporary report cursor. You need to add 2 columns to your query as place-holders and be sure your do your cursor as " INTO CURSOR READWRITE " as we will be writing to this from within the report... that is the trick.
Next, modify your report. Go to the detail band and put a single line at the bottom of it. Adjust as needed if you need a few pixels under the last detail element. Double click the line and get to the tab where it allows you to put in a "Print When" condition for the line. Enter one of the new column names called "ShowLine" (but without the quotes).
Now, the "hook" for smoke and mirrors. Create another textbox field output in the report detail. It can be as small as 2 pixels wide and never actually prints anything. It can be put at the beginning or end of the report detail, no matter, just as long as its in the detail band. Double click it to bring up what it will print. In the expression, enter the following... WhatPageAmIOn( _PageNo )
This will actually call a function we'll add to your program which writes back to your report cursor... I'll hit that next.
Now, the code. The following is a sample snippet of code I've written to query the data for the report, have the extra columns, and put into a READWRITE cursor. From that, I run the report but to NOCONSOLE so it doesn't actually visually do anything, just runs in the background. It then cycles through and looks for the break between each page and goes backward 1 record from the break and stamps that record as "ShowLine" = .T... Then run the report again as normal and you have your one line appearing in the detail band regardless of a data group, but always the last data line at the end of each page.
Here's the code
*/ Query your data, order by whatever,
*/ but tack on the two extra fields and make it READWRITE
select;
YourData,;
AnotherField,;
MoreData,;
.f. as ShowLine,;
00000 as WhatPage;
FROM ;
YourData;
ORDER BY ;
WhateverForYourReport
INTO ;
CURSOR C_RptData READWRITE
*/ Pre-run the report NOCONSOLE so your windows don't get messed up / scrolled
REPORT FORM YourReport NOCONSOLE
*/ now, go back to the cursor that your report ran with
SELECT C_RptData
*/ set a variable for the first page you are looking to find a break for.
*/ in this case, the first detail that APPEARED on page 2.
lnLastPage = 2
*/ Start at top of the report cursor file and keep going until we reach
*/ the end of file where the LOCATE can no longer find "Pages".
GO TOP
DO WHILE NOT EOF()
*/ find the first record on ex: Page 2
LOCATE FOR WhatPage = lnLastPage
*/ Did we find one?
IF FOUND()
*/ Yes, go backwards 1 record
SKIP -1
*/ This is the last detail that appeared on the page before it (ie: pg 1)
*/ Mark this line as ok to "ShowLine" the next time the report is run.
replace ShowLine WITH .T.
*/ Now, advance the page counter to look for the NEXT page break...
*/ ex: between page 2&3, 3&4, 4&5, etc...
lnLastPage = lnLastPage +1
ENDIF
ENDDO
*/ Run your final version of the report
REPORT FORM YourReport Preview (or print)
RETURN
Here's the only hook below to track/update the page associated with the detail. I don't know if you have a main "SET PROCEDURE TO" file, or just a bunch of free .PRG files all in your project, or even if your reporting is done from within a PRG file itself. however, all you need is this function to be included in any of those locations. For simplest test, I would just create it as a stand-alone .prg file (if you are NOT using SET PROCEDURE, or doing your report within a PRG file and not from within a class method/event).
FUNCTION WhatPageAmIOn
LPARAMETERS lnPage
replace whatPage WITH lnPage
RETURN ""
As in the original description, the report is going to include a field in the detail band based on a function "WhatPageamIOn" and passes the parameter of _PageNo which is the internal VFP variable that keeps track of the current report page that is typically used in report header / footers. So, as each detail is getting processed, we are "STAMPING" the detail data with whatever the page is. We return an empty string "" so nothing actually gets printed, yet we've hooked what we needed. From this, the loop finding the first record at the beginning of every page (starting at page 2), and skipping backwards to the last entry for the prior page and we're done.
Good luck.

How Do I Build a Mailto Hyperlink Column in a Cognos Report?

I am building a report which shows a list of users that are out of compliance due to not meeting a training deadline.
The queries that show and filter the data have been built and I have verified the correct information is showing in my list.
I now want to add some "action items" to the grid. The first item I am working on is a "Hyperlink Button" that will launch an email to the out-of-compliance user. The email should be addressed to this user, have a hard coded subject, and contain a body that has hard coded text with some data points from the query.
The "List Column Body" for the button column has its "Source Type" property set to "Report Expression"
Expression:
'mailto:'+ [ExceptionsByOrgQuery].[Email] + '?subject=Compliance%20Exception&body=Hello%20' + [ExceptionsByOrgQuery].[Full Name - First Last] + '%2C%0D%0A%0D%0AYou%20are%20overdue%20for%20training.%20%20Please%20complete%20the%20following%20training%20as%20soon%20as%20possible.%0D%0ATraining%20course%3A%20' + [ExceptionsByOrgQuery].[Activity Name] + '%0D%0ADue%20Date%3A%20' + [ExceptionsByOrgQuery].[Date]
All the variables that are used to build the link are in the query and should be matching up to the items for that row, correct?
For some reason I am getting an error when trying to validate this report.
The error I receive is:
RSV-VAL-0032 The following expression is not valid:...expression here... If the item exists in a query but is not referenced in the layout, add it to a property list. CRX-API-0005 An error ocurred at or near the position '11'. The variable named 'ExceptionsByOrgQuery].[Email]' is invalid.
I'm more unsure what the first part of the error means. The email variable is not shown in the grid, but it is part of the query. I can add it to the grid and verify that it is in the query, but I do not want that value to display in the report (nor do I want the variable [Full Name - First Last] to be displayed; it's just for the greeting in the email).
ADDITIONAL INFORMATION:
The List is populating from a query called [ReportQuery]
It contains the following data items.
[Name] <- [Compliance].[Employee].[Last Name] + ', ' +[Compliance].[Employee].[First Name]
[Organization] <- set([Dimensional View].[Organization].[Organizations] -> ?org?)
[Registration Status] <- [Compliance].[Fact Organization Due Exception].[Registration Status]
[Title] <- [Compliance].[Employee].[Title]
[Activity Name] <- [Compliance].[Activity].[Activity Name]
[Due Date] <- [Compliance].[Time].[Date_US]
[Email] <- [Compliance].[Employee].[Email]
[Name - First Last] <- [Compliance].[Employee].[First Name] + ' ' +[Compliance].[Employee].[Last Name]
(the first item is the label and the second portion is expression that is used to make the data item)
EDIT 1 (from melee's suggestions):
I've attempted the method you describe, but am now seeing this error: RSV-VAL-0032 The following expression is not valid: ''. If the item exists in a query but is not referenced in the layout, add it to a property list. CRX-API-0005 An error ocurred at or near the position '21'. The variable named '[ReportQuery].[Email]' is invalid.
I did a query regarding this error and saw that that the List object needed to have the properties that I used in the mailto in a "Properties" property. Defining this property allowed me to select items from the query. I did this with mailto, but it appears to be not matching up values to the correct row; ie. I've set the subject argument on the mailto to be the user's name ([ReportQuery].[Name]) and it doesn't match up with what is shown on the row in the table.
Ok, so you're going to need to follow these steps to get this to work properly - your syntax, concatenation, and everything else looks great - just a little tweaking of the process and you'll be good to go.
Drag an HTML item into a list report.
Select it - under the properties pane, change "Source Type" to "Report Expression" (defaults to Text, which is of no use to us right now)
Double click the HTML item and create the mailto anchor You can use your code sample, but make sure it is validating correctly before closing. it should, at its simplest, look something like: '<a href="mailto' + [Data Item] + '">' - important; do not close the anchor tag at this point.
Unlock the report (padlock on the top)
Add another HTML item to the cell (it will look like there's two HTML items in the same column) and set it to "Report Expression"
Double click the HTML item and add static text/close the tag. For example: Email Me</a>
Run the report and you should have links that you can click (tested as working on 8.4.1)

Resources