set report cache path not work in stimul - stimulsoft

My stimul cache size is too big its about 40G.
I want to change path of this cache so I do Like This:
Dim CacheFolder As String ="E:\StimulsoftReportsCache"
report1.ReportCachePath = CacheFolder
report1.ReportCacheMode = StiReportCacheMode.On
report1.RenderedPages.CanUseCacheMode = True
report1.RenderedPages.CacheMode = True
report1.RenderedPages.Clear()
'IN This Section Load Report On Report1
report1.Compile()
After That When I Compile Report report1.ReportCachePath change to ""
I Dont Know Why It Change

You should set the Cache path with next static method:
Stimulsoft.Report.StiOptions.Engine.ReportCache.CachePath

Related

Get datetime when access database content was last modified

I am trying to get the last modification date of database content, to know when to refresh some data. I thought this would work:
Static ADOCat As ADOX.Catalog
If Not ADOCat Is Nothing Then Set ADOCat = New ADOX.Catalog
If ADOCat.ActiveConnection Is Nothing Then ADOCat.ActiveConnection = "Provider=Microsoft.ace.OLEDB.12.0; Data Source=X:\MANUAL_ANALYSIS.accdb; Mode=Read"
If LastModificationDate <> ADOCat.Tables("ANALYSES").DateModified Then
bRefreshData = True
LastModificationDate = ADOCat.Tables("ANALYSES").DateModified
End If
However, the .DataModified returns the date when the table structure was changed, such as removing/adding fields, not the database content modification. Is there another method that can find this out for me?
/J

Uploading file to iManage/Worksite to a particular folder

I have a particular FolderID and I'd like to upload files to this directory. (I have the reference to the iManage.dll and ImanEXTLib).
I'm struggling with filling out certain fields in the dialog/import window from the code level.
Ideally, I would like to skip this stage to make the upload faster. If I'm conveying all the required data then I can't see any point in the dialog besides clicking OK.
This is the code:
I'm locating the folder by using ManDMS.CreateSearchParameters
After getting results:
Dim rslts as IManFolders
Set rslts = IManSession.WorkArea.SearchFolders(<ManStrings>,<SearchParameters>)
If rslts.Empty = True Then
MsgBox "Found shit."
Elseif rslts.Empty = False Then
Dim TgtFdr as ImanFolder
Set impCmd = ImportCmd
Set context = New ContextItems
Set TgtFdr = rslts.ItemByIndex(1)
Now I'm setting the context items but I have the problem with Matter and Subclass. These are obligatory for the upload but the fields remain empty and I don't know how to address them to complete the upload:
context.Add("IManDestinationObject", TgtFdr)
context.Add("IManExt.Import.DocAuthor", UserID)
context.Add("IManExt.Import.DocDescription", file Name)
context.Add("IManExt.Import.FileName", file path)
context.Add("IManExt.Import.DocClass", "some info")
context.Add("IManExt.Import.DocSubclass", "some info")
context.Add("IManExt.Import.DocMatter", "some info")
impCmd.Initialize context
impCmd.Update
If impCmd.Status = IMANEXTLib.CommandStatus.nrActiveCommand Then
impCmd.Execute
Else
Endif
Tried different things - MatterID, MatterDesc, Custom1,2,3,. Is it possible to skip the part with this window and upload the file in a more straightforwrd way? Also, is it possible to to take out the doc number of the newly imported file at the end?
I tried:
UplDoc = (ImanDocument)context.Item("ImportedDocument")
I figured the whole thing out.
Sort of... I went into the object browser and managed to go around the problem and take advantage of the .DuplicateProfileFromDoc method. I simply mirror the profile of the uploaded doc from other already stored on worksite.
The last bit also solved.
It should be:
Set UplDoc = context.Item("ImportedDocument")
Cheers!

Replace all in a specific folder

In my Test Plan I have two folders. One with all my active test cases and one with all my archived test cases. I need to replace a lot of 'Affected Module' from one value to another, however - I don't want the folder with archived to be affected by this.
So, is there a way of doing search and replace only on a specific folder (and all the sub-folders) in HP ALM?
As far as I know the search and replace function in grid view replaces all instances of the value so I can't use that directly.
Here is a simple OTA code that updates the field ts_user_04 for all the test case in folder Subject\Automated and its sub-folder from whatever value to Quoting.
Please, change the column name as per your requirement. You can easily find the DB column for any field in HP ALM by going to the Management tab if you have access to it. Even otherwise you can get all the mapping by using OTA. (I hope you have the necessary access)
Inorder to run the OTA code, you need to install ALM Connectivity add-in which you can get it from the tools section in your ALM home page
Public TDconnection
Public reqPath
Public testPath
'Call the main Function
updateAllTests
Public Function login()
Dim almURL, almUserName, almPassword, domain, project
almURL = "https://.saas.hp.com/qcbin/"
almUserName = ""
almPassword = ""
domain = ""
project = ""
testPath = "Subject\Automated" ' Change it as per your folder structure
Set TDconnection = CreateObject("tdapiole80.tdconnection")
TDconnection.ReleaseConnection
TDconnection.InitConnectionEx almURL
TDconnection.login almUserName, almPassword
TDconnection.Connect domain, project
End Function
Public Function updateAllTests()
login
Set TreeMgr = TDconnection.TreeManager
Set TestTree = TreeMgr.NodeByPath(testPath)
If Err.Number = 0 Then
Set comm = TDconnection.Command
comm.CommandText = "update test set ts_user_04='Quoting' where ts_test_id in (select ts_test_id from test, all_lists where ts_subject in (select al_item_id from all_lists where al_absolute_path like (select al_absolute_path from all_lists where al_item_id=" & TestTree.NodeID & ") || '%' ) and ts_subject = al_item_id)"
comm.Execute
End If
logout
MsgBox "Flag Update successful", vbInformation
End Function
Public Function logout()
TDconnection.Disconnect
TDconnection.logout
TDconnection.ReleaseConnection
Set TDconnection = Nothing
End Function

Replace hard-code path with dynamic path of vbscript

I have a vbscript that opens a workbook and runs a procedure in the module1 of the workbook, then closes the workbook. Works great. But here's the thing. The path to the workbook is hard coded, like this:
Set xlBook = xlApp.Workbooks.Open("E:\FolderName\WorkbookName.xlsm", 0, True)
I don't mind requiring the user to have the script and the workbook in the same folder, and requiring that they not change the name of the workbook file, but I'd like to just substitute the hard coded path with something dynamic, like:
Set xlBook = xlApp.Workbooks.Open(VBSPath & "\WorkbookName.xlsm", 0, True)
So the path is whatever is the path of the script.
Is that possible? Any other ideas?
tod
VBScript provides various information about the current script and host process via properties of the WScript object, among them:
ScriptFullName: The full path to the current script.
ScriptName: The filename of the current script.
You can derive the script folder from the ScriptFullName property in a number of ways, e.g.
By using the GetParentFolder method:
Set fso = CreateObject("Scripting.FileSystemObject")
dir = fso.GetParentFolderName(WScript.ScriptFullName)
By using the Len and Left functions:
dir = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
By using the InStrRev and Left functions:
dir = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\"))
By using the Split and Join functions:
a = Split(WScript.ScriptFullName, "\")
a(UBound(a)) = ""
dir = Join(a, "\")
By using the Replace function:
dir = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
Note that this approach might prove problematic if (for whatever reason) the script name appears somewhere else in the full name of the script as well (e.g. C:\script.vbs\script.vbs).
You can try like that :
VBSPath = Left(WScript.ScriptFullName,(Len(WScript.ScriptFullName) - (Len(WScript.ScriptName) + 1)))
msgbox VBSPath
I figured out one solution, very similar to what has been posted here.
I created a WScript.Shell object:
Set WshShell = CreateObject("WScript.Shell")
Then I used the CurrentDirectory as the path of the workbook:
Set xlBook = xlApp.Workbooks.Open(WshShell.CurrentDirectory & "\WorkbookName.xlsm", 0, True)
Works!

Macro wont run for all users

The error occurs on
Set report = app.OpenReport("S:\Supply Chain\Scheduling\HRE\HRE.imr")
It works for some users and not others.
Any alternative methods or maybe some settings that need to be changed?
Its an objected defined error.
`Sub Update()
Dim app As Object
Dim report As Object
Dim catalog As Object
'open cognos'
Set app = CreateObject("CognosImpromptu.Application")
app.Visible True
app.Activate
'open catalog'
app.OpenCatalog "R:CognosUsers/Cognos Catalogs/SUPPLY CHAIN.cat"
app.Visible True
app.Activate
'open report'
Set report = app.OpenReport("S:\Supply Chain\Scheduling\HRE\HRE.imr")
report.RetrieveAll
'save report path'
report.Export "S:\Supply Chain\Scheduling\HRE\Raw", "X_ascii.flt"
'close cognos'
report.CloseReport
app.Quit`
You might have already looked at this, but the first thing I would check is (1) if the R:\ and S:\ are properly mapped (if you click on the R:\ and S:\ in the file explorer, does it take you where you would expect?); (2) that the user has access to the various folders/files/applications in the code.

Resources