I am currently attempting to create a new Activity type that has it's own maintenance screen.
The most logical approach I came up with was to create a new subclass based on CRActivity with the PXSubstitute flag to replace the stock value with mine that has the extra class types in it.
This works for displaying my new class on the screen however whenever I click on any of the items I always receive the message:
Error #97: A cache instance cannot be created for the type CRActivity.
For reference, here is how i'm defining my new class
[CRActivityPrimaryGraph]
[Serializable]
[PXSubstitute()]
[PXCacheName(PX.Objects.CR.Messages.ActivityClassInfo)]
[PXEMailSource]
public partial class CustCRActivity : CRActivity
{
.....
}
I took a step back and tried another approach by doing the same process but for CRPMTimeActivity. This causes all of the standard Class types to work but my new type gives the same type due to the CRActivityPrimaryGraph not knowing what my new activity type's nagivation is.
Has anyone ever created a new activity type such as this?
Updated 4/28
Below is a screenshot of what I was attempting to accomplish
I did finally get it to work but not quite the way I was hoping.
The initial error message was apparently build specific. After updating to a newer build that particular error went away.
What I discovered was even though I could Substitute CRActivity, most of the screens themselves were utilizing CRPMTimeActivity which has different attributes associated to it. CRPMTimeActivity is a subclass of CRActivity and the majority of the processes cast the activity to CRActivity.
A subclass of CRPMTimeActivity cannot be cast as CRActivity. Because PXSubsitute relies on the base class, this caused casting issues when attempting to add new activities.
In the end I had to create my own custom CRPMTimeActivity class and the base classes then customize the screens themselves to use my version of the activity builders.
The result is shown in the screen shot
Related
We have a wrapper screen of Production Order, and using same allocation button as on production Order,
It is working as expected when there is single line added in the allocation popup, as soon as second line is added, we are getting object reference error.
I think there is some events bind in LSProdMatlLine but these events are not fired when used by other screen.
can you please help me to provide details for using the allocation feature and overriding it.
Error was due to the cache inheritance problem within the same PXGraph where the Base class (INLotSerialStatus) and Derived class (LotSerialStatus) share the same cache and so, while trying to access/get the cache of the derived object, it returns the cache of the base type instead of the derived type, thus throwing the “Unable to Cast” error.
So, in order to avoid the error, a dummy view cache for the base type before creating any other views as follows:
public PXSelect<INLotSerialStatus> dummyINLotSerial;
I am using a blank core data proj and trying to copy the code from this examples.
https://www.and
rewcbancroft.com/2015/02/18/core-data-cheat-sheet-for-swift-ios-developers/
As there is no managedContext i am not able o proceed.
I am new to IOS programming. Please can anybody share me a simple example that i can start with. But i need it with Xcode8 beta4 version.
I tried many other examples but once i convert them to my current version they are not working.
The error message reads:
Value of type 'ViewController' has no member 'managedObjectContext'
What this means is that somewhere (your screenshot does not show where) you are attempting to assign a value to a property named managedObjectContext, on an instance of your ViewController class. Except that this class doesn't have a property named managedObjectContext, so Swift complains and doesn't compile.
This is not actually a Core Data question-- it's basic Swift. It would happen for any attempt to assign a value to a nonexistent property.
You probably (again, your screenshot does not provide enough detail to be sure) need to create this property on your view controller class, with type NSManagedObjectContext.
For every managed object that is sent via iCloud update, this warning/error is sent to the console:
*** ERROR: this process has called an NSArray-taking method, such as
initWithArray:, and passed in an NSSet object. This is being
worked-around for now, but will soon cause you grief.
My managed objects are Clients and have a one to many relationship with assessments as shown below.
class Client: NSManagedObject {
//other NSManaged vars are here
#NSManaged var assessment: NSOrderedSet
}
Judging by the timing of this error (during ubiquitous updates) and the fact that this is my only use of NSSet objects in my project, I can presume that a function during this update is being passed an NSOrderedSet when its expecting an NSArray.
Turning off iCloud removes the errors.
I found two other folks with a very similar issue:
Using iCloud enabled Core Data NSArray-taking method
Core Data Relation between Objects
However, neither offers any solution to my problem. Everything is working fine right now, however "it will soon cause you grief."
If this isn't resolved here, I'll take this issue up with the apple dev support.
I figured it out how to fix this error after much research. (No help in from the Apple Dev forums).
This is error is caused by the Swift 1.2 upgrade. They encourage you to use their new Set<> class instead of NSSet. The error was a vague way of reinforcing that claim.
Ordering of my data was ultimately handled by my NSFetchedResultsController, so I didn't need the stored data to be ordered. So I set out on a task to change the data type for my one to many relationship from NSOrderedSet to Set.
So I created a new data model, selected my relationship and unchecked "Ordered" in the data model inspector. Then migrated to the new model in the next run. (as shown below)
Once that was done, I changed the data type in my managed object subclass from NSOrderedSet to Set. (or Set). That generated compiler errors that were easy to fix throughout my code.
The new Set class easily converts to an array: Array(mySet)
To insert an object to the set, there's an easy insert method. foo.mySet.insert(objectToInsert).
Side note: Converting my relationship to a Set also fixed some weird ordering issues I was having with my table views and the NSFetchedResultsController.
Then I ran the program, generated data, uninstalled the program. Ran the program again and watch the glorious iCloud data populate without the annoying errors.
Boom. I hope this saves someone out there the 10 hours of turmoil (I tried a lot of different things..) I spent to fix this.
I've created a cutom BindingNavigator with custom ToolStripButton(s), basically working with datasets, in which I've coded delegate actions to perform when adding, deleting and updating records.
As I'm moving to EF5, I would like to make the same thing, the idea still the same, but when executing these three methods:
this.BindingSource.AddNew();
this.BindingSource.RemoveCurrent();
this.BindingSource.Update();
modifications are made in runtime but not in database.
I found later that i must execute
context.SaveChanges();
to make data concrete.
Can anyone help on how to call the context from the custom binding navigator class.
In my DSL project I have a shape with a number of decorators that are linked to properties on my domain class. But even though ieach decorator has a DisplayName property (set to a meaningfull value) it does not appear in the generated DSL project. (I have not forgtten to use regenerate the t4 files.)
Do I have to create another decorator for each property that only has the display name as a value that I wish to display or is there some other way that I can't figure out right now?
I assume by a display name for the decorator you mean you want the element in the generated DSL to appear as "Example = a_value" where a_value is the actual value and Example is the property name.
What I've done with this in the past is to create second property "ExampleDisplay" that's not browsable and is what the decorator actually points to. I then set the Kind property of the ExampleDisplay to "Calculated". You then need to provide the method that the toolkit tries to call to display the decorator which you can do a partial class.
partial class ExampleElement
{
string GetExampleDisplayValue()
{
return "Example : " + this.Example;
}
}
This is not ideal as you don't get a good way of setting the property on the DSL diagram you have to use the properties window. (There's sometime lags from the property window unless you hook into the update of the underlying property too). Getting the slick editing in the GUI that actual DSL toolkit does maybe possible but I haven't found out how.
It maybe worth ask VSX forums if you haven't already done so.