I'm trying to add a purchase line to a purchase order in Dynamics NAV (2009 R2 Classic) using web services, but I'm running into a peculiar issue.
Creating a purchase line without defining a No works sans problem. Only when I define a No, like in the example below, I get the following exception:
You cannot enter 'Order' in Integer.
Dim purchaseLine = New PurchaseLine
purchaseLine.Document_No = myPurchaseHeader
purchaseLine.Document_Type = Document_Type.Order
purchaseLine.Document_TypeSpecified = True
purchaseLine.Line_No = 1000
purchaseLine.Line_NoSpecified = True
purchaseLine.Type = Type.Item
purchaseLine.TypeSpecified = True
purchaseLine.No = myItemNo ' Defining No seems to cause the problem.
purchaseLineService.Create(purchaseLine)
I've tried creating the purchase line first, without defining No. Which works, but updating it with No defined, results in the same.
purchaseLine.No = myItemNo
purchaseLineService.Update(purchaseLine)
It was suggested somewhere to try using 1 and "1" for Document_Type, but that didn't work either.
I've also followed the steps described here, without success.
While googling I found some forums where people had a similar problem, but they didn't get me closer to a solution.
Any idea's?
Edit:
After doing some more research and testing, I've concluded that my NAV installation is incomplete/flawed/messed up. More details here.
The problem is corrected with this change in codeunit 422, function FormatValue.
//*** BEGIN
// EVALUATE(OptionNo,FORMAT(fldRef.VALUE))
IF NOT EVALUATE(OptionNo,FORMAT(fldRef.VALUE)) THEN
EXIT(FORMAT(FldRef.VALUE));
//*** END
Related
after all my trials to create a pdf with a table that contains Arabic text using itext7 failed, I decided to move to the normal way, where I use view.draw and save the result in a pdf. but this also didn't work. here's the code:
Android.Graphics.Pdf.PdfDocument pdf_new = new Android.Graphics.Pdf.PdfDocument();
Android.Graphics.Pdf.PdfDocument.PageInfo pageInfo_new = new Android.Graphics.Pdf.PdfDocument.PageInfo.Builder(6000, 6000, 0).Create();
Android.Graphics.Pdf.PdfDocument.Page page_new = pdf_new.StartPage(pageInfo_new);
ListView listView = new ListView(this.Context);
accounts_info_homeadapter hmm = new accounts_info_homeadapter(this, pdflist);
listView.Adapter = hmm;
listView.SetBackgroundColor(Android.Graphics.Color.Aqua);
listView.Draw(page_new.Canvas);
// lst.Draw(page.Canvas);
//TextView txt = new TextView(this.Context);
//txt.Text = "hi";
//txt.Draw(page.Canvas);
var path = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
file_Path = Path.Combine(path.ToString(), "Client.pdf");
new_stream = new FileStream(file_Path, FileMode.Create);
new_stream.Flush();
pdf_new.WriteTo(new_stream);
new_stream.Close();
pdf_new.Close();
I got the exception: java.lang.illegalstateexception: 'current page not finished!' though I tried this a week ago on a trial list and it was working. now i'm getting this. I thought it might be the size of the pdf so I started increasing it but in vain. I tried changing my variables' names, I thought maybe because I tried to use them with my itext before, but still nothing. I deleted the fragment I 'm working on and then recreated it, also nothing. anyone know what the problem is. thanks in advance.
You missed one line. You forgot to close the page after editing it.
pdf_new.finishPage(page_new)
You must finish the page by calling finishPage(page) before closing the page otherwise it will throw an exception.
From close() docs reference:
Do not call this method if the page returned by startPage(android.graphics.pdf.PdfDocument.PageInfo) is not finished by calling finishPage(android.graphics.pdf.PdfDocument.Page).
In your case it should be:
pdf_new.finishPage(page_new);
pdf_new.close();
Source: close() method docs reference
After inserting your desired text in the canvas make sure to place this line of code.
This helped me to remove my error
canvas.drawText("Financial Statement for 2021",40,50,myPaint);
myPdfDocument.finishPage(myPage1); //this one
So essentially, I installed a NuGet Package in C# ASP.Net (Day Pilot Scheduler), purely for testing purposes.
Now though, after removing it completely from my Website, I am continually getting the same errors, with assembly references etc.. (There is literally nothing wrong with them as I haven't changed ANYTHING regarding them.
Account account = new Account();
Job job = new Job();
int jb = (from j in context.Job
where j.jobType == "Customer"
select j.jobId).Single();
account.username = registerUsernameTxtbox.Text.ToString();
account.password = registerPasswordTxtbox.Text.ToString();
account.Job = jb;
context.Account.Add(account);
context.SaveChanges();
The code that is getting the errors on it is appearing on, is anything that references the class 'Account'. (so it appears on 'Account', 'username', 'password' and 'Job'
context also appears with an error, which also baffles me because I created an instance and the instance is fine.
Here is an image of the issues showing the errors too.
http://i.imgur.com/tE9YuH7.png
With error '7'. I have attempted to delete the folder it states, and it appears again after reopening the website.
I have also removed everything regarding DayPilotScheduler too but still failed on removing these errors.
Does anyone have any idea for this? I have googled it but failed to find any information regarding this.
this was due to having a "table" called 'Account' in one Class, and a webform called Account it seems. It removed the initial errors, and left me with a few more (ones that I think I should be able to fix.).
I'm trying to control a PTZ camera with the http://www.onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl file.
I can use the GotoPreset function without a problem but the ContinuousMove function throws an ProtocolException.
Page 77 of this guide shows an example of how the ConinuousMove function should be used.
Following this guide provided me with the following code:
OnvifMediaClient.Profile[] profs = this.mediaClient.GetProfiles();
OnvifMediaClient.Profile profile = mediaClient.GetProfile(profs[0].token);
OnvifPTZ.PTZConfigurationOptions options = PtzClient.GetConfigurationOptions(profile.token);
OnvifPTZ.PTZSpeed velocity = new OnvifPTZ.PTZSpeed();
velocity.PanTilt = new OnvifPTZ.Vector2D();
velocity.Zoom = new OnvifPTZ.Vector1D();
velocity.PanTilt.x = options.Spaces.ContinuousPanTiltVelocitySpace[0].XRange.Max;
velocity.PanTilt.y = options.Spaces.ContinuousPanTiltVelocitySpace[0].YRange.Max;
velocity.PanTilt.space = options.Spaces.ContinuousPanTiltVelocitySpace[0].URI;
velocity.Zoom.x = options.Spaces.ContinuousZoomVelocitySpace[0].XRange.Max;
velocity.Zoom.space = options.Spaces.ContinuousZoomVelocitySpace[0].URI;
PtzClient.ContinuousMove(profile.token, velocity, "1000");
Thread.Sleep(2000);
PtzClient.Stop(profile.token, true, true);
But there are some differences with the code in the guide, for example the actual ContinuousMove function requires 3 parameters in my code instead of 2 as in the guide. The extra parameter is a timeout so i think that won't make that much difference but maybe some other things are different that cause my code to fail.
I dit read the awnser of this question in wich the person said the PTZ camera didn't support the ver20. But when I add a service reference to the wsdl with ver20 changed to ver10 I get a message that adding the wsdl failed because it contains links that could not be resolved. Also when i paste the ver10 url (http://www.onvif.org/onvif/ver10/ptz/wsdl/ptz.wsdl) in my webbrowser it shows an xml instead of an wsdl.
How can I use the right wsdl file if i'm not using it already or what could resolve the behaviour in my current setup?
I found a solution.
It turns out I misunderstood the timeout parameter in PtzClient.ContunuousMove. In the previous wsdl version (ver10) you had to call the Stop function everytime you wanted the current PTZ action to stop. In ver20 of the wsdl the PTZ function (unless the Stop function is called) will last as long as specified in the timeout parameter. I thought it was a response timeout or something but it's not.
Calling ContinuousMove now looks like this:
PtzClient.ContinuousMove(profile.token, velocity, "PT1S");
Where the number in the string stands for the amount of seconds the PTZ action should last.
Hope it helps someone.
I have pretty annoying problem. :)
visual = context.ActiveVisualReference;
TablePlot tablePlot = visual.As<TablePlot>();
colorings = tablePlot.Colorings;
categories = colorings.GetCategories();
coloring1 = colorings.GetColoringForCategory(categories[0]);
coloring2 = colorings.GetColoringForCategory(categories[1]);
coloring3 = colorings.GetColoringForCategory(categories[2]);
category2 = categories[2];
bool removed = colorings.Remove(coloring2);
This is the C# code I execute at the custom Tool level and the problem is that I do not see any effect within the Web Professional (using 5.5)
of the Remove method execution.
According to the documentation the method should remove the custom coloring from visualisation and it does NOT.
Perhaps it is needed to call some method that refreshes view but I didnt manage to locate it.
Please help. :)
http://stn.spotfire.com/dxp/html/M_Spotfire_Dxp_Application_Visuals_ConditionalColoring_ColoringCollection_Remove.htm
Have you tried tablePlot.Colorings = colorings at the end of your code ? What is the value of "removed" at the end of your code ?
In ironPython this one works:
from Spotfire.Dxp.Application.Visuals import TablePlot
print myVisual.Title
myTablePlot = myVisual.As[TablePlot]();
print myTablePlot.Title
myColorings = myTablePlot.Colorings;
myCategories = myColorings.GetCategories();
print myCategories.Count
myColorings.Remove(myColorings.GetColoringForCategory(myCategories[1]))
I got the following snippet (SomeName/SomeDomain contains real values in my code)
var entry = new DirectoryEntry("LDAP://CN=SomeName,OU=All Groups,dc=SomeDomain,dc=com");
foreach (object property in entry.Properties)
{
Console.WriteLine(property);
}
It prints OK for the first 21 properties, but then fail with:
COMException {"Unknown error (0x8000500c)"}
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.PropertyEnumerator.get_Entry()
at System.DirectoryServices.PropertyCollection.PropertyEnumerator.get_Current()
at ActiveDirectory.Tests.IntegrationTests.ObjectFactoryTests.TestMethod1() in MyTests.cs:line 22
Why? How can I prevent it?
Update
It's a custom attribute that fails.
I've tried to use entry.RefreshCache() and entry.RefreshCache(new[]{"theAttributeName"}) before enumerating the properties (which didn't help).
Update2
entry.InvokeGet("theAttributeName") works (and without RefreshCache).
Can someone explain why?
Update3
It works if I supply the FQDN to the item: LDAP://srv00014.ssab.com/CN=SomeName,xxxx
Bounty
I'm looking for an answer which addresses the following:
Why entry.Properties["customAttributeName"] fails with the mentioned exception
Why entry.InvokeGet("customAttributeName") works
The cause of the exception
How to get both working
If one wants to access a custom attribute from a machine that is not
part of the domain where the custom attribute resides (the credentials
of the logged in user don't matter) one needs to pass the fully
qualified name of the object is trying to access otherwise the schema
cache on the client machine is not properly refreshed, nevermind all
the schema.refresh() calls you make
Found here. This sounds like your problem, given the updates made to the question.
Using the Err.exe tool here
http://www.microsoft.com/download/en/details.aspx?id=985
It spits out:
for hex 0x8000500c / decimal -2147463156 :
E_ADS_CANT_CONVERT_DATATYPE adserr.h
The directory datatype cannot be converted to/from a native
DS datatype
1 matches found for "0x8000500c"
Googled "The directory datatype cannot be converted to/from a native" and found this KB:
http://support.microsoft.com/kb/907462
I have the same failure. I´m read and saw a lot of questions about the error 0x8000500c by listing attribute from a DirectoryEntry.
I could see, with the Process Monitor (Sysinternals), that my process has read a schema file. This schema file is saved under
C:\Users\xxxx\AppData\Local\Microsoft\Windows\SchCache\xyz.sch.
Remove this file and the program works fine :)
I just encountered the issue and mine was with a web application.
I had this bit of code which pulls the user out of windows authentication in IIS and pulls their info from AD.
using (var context = new PrincipalContext(ContextType.Domain))
{
var name = UserPrincipal.Current.DisplayName;
var principal = UserPrincipal.FindByIdentity(context, this.user.Identity.Name);
if (principal != null)
{
this.fullName = principal.GivenName + " " + principal.Surname;
}
else
{
this.fullName = string.Empty;
}
}
This worked fine in my tests, but when I published the website it would come up with this error on FindByIdentity call.
I fixed the issue by using correct user for the app-pool of the website. As soon as I fixed that, this started working.
I had the same problem with a custom attribute of a weird data type. I had a utility program that would extract the value, but some more structured code in a service that would not.
The utility was working directly with a SearchResult object, while the service was using a DirectoryEntry.
It distilled out to this.
SearchResult result;
result.Properties[customProp]; // might work for you
result.Properties[customProp][0]; // works for me. see below
using (DirectoryEntry entry = result.GetDirectoryEntry())
{
entry.Properties[customProp]; // fails
entry.InvokeGet(customProp); // fails as well for the weird data
}
My gut feel is that the SearchResult is a little less of an enforcer and returns back whatever it has.
When this is converted to a DirectoryEntry, this code munges the weird data type so that even InvokeGet fails.
My actual extraction code with the extra [0] looks like:
byte[] bytes = (byte[])((result.Properties[customProp][0]));
String customValue = System.Text.Encoding.UTF8.GetString(bytes);
I picked up the second line from another posting on the site.