Scripting.Dictionary .Add data member not found - vb6

I am new to visual basic and I am working on vbjson i-e integrating it in already written application(Visual Basic 6.0) and in its module JSON.bas there is method to add key and value in dictionary. The problem is compiler always gives error that data member not found.
I am able to see the class libraries and its members from object browser .
script.dictionarylibrary has class with add member but dictionary in word library doesn't have it .
I don't know how to resolve this error. here is the code
Set parseObject = New scripting.Dictionary
parseObject.Add sKey, parseValue(str, Index)

Related

Calling a custom api via c# sdk

I have this custom api called "pits_PostProjectLineEntries" which takes in a EntityCollection called Transactions. I am using the option to have the entities in that EntityCollection to be expando since I really not need to create a table to hold this entities. I am able to call the custom api via PostMan with some raw json, and it works perfectly. My issue is when I use C# Plugins, I am getting errors messages about the entities logical name within Transactions collection. Is there a way to tell the Xrm SDK that these entities are not tied to a physical table but are just expando.
Here is the code that calls the Custom API for ref.
_transactions = new List<Entity>();
Entity Transaction = new Entity("");
Transaction["date"] = userReport.GetAttributeValue<DateTime>("pits_date");
Transaction["project"] = userReport.GetAttributeValue<EntityReference>("pits_project");
Transaction["resource"] = userReport.GetAttributeValue<EntityReference>("pits_user");
Transaction["task"] = userReport.GetAttributeValue<EntityReference>("pits_task");
Transaction["worktype"] = response["WorkType"];
Transaction["shifttype"] = response["ShiftType"];
Transaction["quantity"] = RG;
Transaction["chargeable"] = true;
Transaction["tx_type"] = 361200000;
_transactions.Add(Transaction);
EntityCollection Transactions = new EntityCollection(_transactions);
OrganizationRequest request = new OrganizationRequest("pits_PostProjectLineEntries");
request.Parameters.Add("Transactions", Transactions);
var response = _context.OrganizationService.Execute(request);
The error message I get is:
An unexpected error occurred: The entity with a name = '' with namemapping = 'Logical' was not found in the MetadataCache.
I am trying to call this custom api and pass it an entity that is tied to a DV Table from the C# sdk.
Sorry if the formatting is bad, I have been using stack overflow for a long time, but first time posting
This is a known bug with Expando entities in the currently shipping SDK assemblies, The Dataverse ServiceClient version (.net / cross platform) of the SDK should be working correctly at this time. You can get that here: https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client/
The libraries from Microsoft.CrmSdk.CoreAssemblies will have the fix on next update (at the time of this writing)

Is there a way for VB6 to throw a type mismatch error when assigning a variable of the same type?

I am trying to figure out the cause of a type mismatch error, but I don't understand the reason it is even being thrown. I am assigning to a variable of the same type that is being assigned from.
Begin bxControls.starTable m_tblClaims 'Defined at the top of the form file
Dim objTable As PVDataTable5.DataTable
Set objTable = m_tblClaims.Table
Begin PVDataTable5.DataTable dtTable 'Defined at the top of the .ctl file
'Property inside of bxControls.starTable
Public Property Get Table() As Object
Attribute Table.VB_MemberFlags = "40"
Set Table = dtTable
End Property
As you can see, the assignment taking place should not be having a type mismatch since they are the same type. Any help would be awesome. TIA
Try this
Dim objTable As PVDataTable5.DataTable
Set objTable = m_tblClaims.Table.Object
Note that this might work in IDE but fail when compiled.
The story of user-controls is mostly of complete lies from the IDE. For instance all user-control properties/methods are called late-bound, even if the IDE intellisense gives look like the callsite is early-bound.
For each user-control type that is currently loaded in the IDE (as part of a project group for instance) the IDE creates surrogate date-type with merged original control properties/methods and some VB supplied ones (like Visible etc.) which are coming from VBControlExtender class.
That is why Dim objTable As PVDataTable5.DataTable sometimes is not declaration of PVDataTable5.DataTable data-type but of the surrogate PVDataTable5.DataTable from an OCA file, that is when the user-control is loaded in the IDE.
The only sane way to pass references to VB6 user-controls that works both if the user-control is loaded and when referenced in compiled OCX is to pass VBControlExtender instead and use its Object property to access the wrapped reference.

UFT Report is broken

Lately we are getting more and more often confronted with problems with UFT. Many API components can't executed anymore, but there are 2 possible outputs:
UFT gives a message from "object reference not set to an instance of an object" without even starting the test, let alone reporting. The Output Pane contains the following message:
Start
object reference not set to an instance of an object
End
when we execute a test using ALM we get a KeyNotFoundException:
2020-01-22 12:04:38,039 HP.ST.Fwk.ReporterFWK.Reporter [ 1] ERROR Problem in writing Step Xml
System.Collections.Generic.KeyNotFoundException: The specified key was not listed in the dictionary.
For System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
for HP.ST.Fwk.ReportCreator.QTPEngine.Utils.GetNodeInfo(Object stepId, XmlDocument xmlDoc, IReportDataContainer reportData)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateOuterCheckpointsXML(Object stepId, XmlDocument doc, XmlNode node, String innerCheckpointsFileName, String childId, IReportDataContainer reportDataContainer)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateFileForReferencedValues(XmlDocument doc, XmlNode& reportNode, Object stepId, IReportDataContainer reportDataContainer)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateXmlFile(Dictionary`2 nodeInfo, Object stepId, XmlDocument doc, IReportDataContainer IReportDataContainer)
for HP.ST.Fwk.ReporterFWK.Reporter.WriteStepToDisk(String stepId, String fileName)
for HP.ST.Fwk.ReporterFWK.Reporter.<>c__DisplayClass36_0.<FlushReport>b__0()
for System.Threading.Tasks.Task.InnerInvoke()
for System.Threading.Tasks.Task.Execute()
We've tried every direction, reinstalling UFT, patching... all to no avail. The behavior seems to be present in both UFT 14.53 and UFT 14.53 Patch 1 - 3. UFT One is also affected.
The UFT support could not help us at all, you know how they are.

How can I access the Google Contact 'File As' field programmatically via the API?

I desperately need to access this field in order to develop a Google Contacts sync tool that predominately utilizes the company name as the NAME or FILE AS field, NOT First/Last.
I see it in the XML but no dice via the libraries. I'm using the .NET library.
I figured it out. Here's a little VB.NET code snippet in case anyone else needs to know how to manipulate values not directly exposed by the gData library. This returns the XML node (and creates first it if it doesn't exist). I actually change the value through the innerText property.
Private Function GetFileAsObject() As XmlNode
For Each ext As Object In _contactEntry.ContactEntry.ExtensionElements
If (ext.GetType() Is GetType(XmlExtension)) Then
If ext.XmlName = "fileAs" Then
Return ext.Node
End If
End If
Next
Dim doc As New XmlDocument
doc.LoadXml("<gContact:fileAs xmlns:gContact='http://schemas.google.com/contact/2008'></gContact:fileAs>")
Dim node As XmlNode = doc.DocumentElement
Dim newExt As XmlExtension = New XmlExtension(node)
_contactEntry.ContactEntry.ExtensionElements.Add(newExt)
Return node
End Function
This link helped immensely: http://code.google.com/p/google-gdata/wiki/UnderstandingTheUnknown

VBA - User-defined type not defined

I am trying to update an VBA module to use the System.Windows.Forms.FolderBrowserDialog class. I declared my object as follows:
Dim MyFolderBrowser As New System.Windows.Forms.FolderBrowserDialog
Running this gave me the error User-defined type not defined. I figured the compiler didn't know about that class so I tried going to Tools > References and adding Systems_Windows_Forms, but I'm still getting the same error. Does anyone know what I'm missing here? Do I need a reference to the library in my code as well?
System.Windows.Forms.FolderBrowserDialog looks like something from .Net to me, not VBA.
You can use Application.FileDialog in Access VBA. This sample uses late binding and allows the user to select a folder from a browse dialog.
Const msoFileDialogFolderPicker As Long = 4
Dim objFileDialog As Object ' FileDialog
Set objFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
With objFileDialog
.AllowMultiSelect = False
If .Show Then
Debug.Print .SelectedItems(1)
End If
End With
If you prefer to use early binding, set a reference to the Microsoft Office [version] Object Library. You could then declare the object like this ...
Dim objFileDialog As FileDialog
And you wouldn't need to define the constant, so discard this line if using early binding ...
Const msoFileDialogFolderPicker As Long = 4

Resources