How to drop duplicates in Workshop Object table - object

in a Workshop App, can duplicates (based on some specific columns) be eliminated from an Object Table? And how?

When I see a question like this, it is normally a hint that you may want a more expressive data model. For instance, if each object has a "category" property and you want to make a table of categories with a count of objects in each category you could:
a) Use a pivot table widget on the primary object
b) Create a new "category" object type linked to each object. Then make a regular object table and have a derived property counting the linked objects.
This can add some flexibility, though it has it's own limitations. You'll be able to easily go from categories -> linked objects, but if you have more the 100k objects and try to search around to the linked categories, you'll hit a limitation. So whether this approach works will depend on the semantics and scale of your data model.

Related

Concatenated SQL fields in selector and/or custom PXDimension

We have a set of BLC/DAC for a customization that has multiple tables with the given relationship
Table1 - T1ID (int-autoincrement), T1CD (char-substitute key)
Table2 - T2ID (int-autoincrement), T2CD (char-subsitute key), T1ID (reference to T1ID)
where the records in Table2 are unique for each given T1ID selected.
The initial design specification was for the users to select first the Table1 value, then the Table2 value (UsrTable1Value, UsrTable2Value respectively) in the data entry screens.
The users have recently asked if it's possible to combine these into one field simular to a Dimension selector so that there is one field resulting in "Table1-Table2" stored as T2ID.
My first thought was to simply create a subclassed dac with a concatenated property for T1CD-T2CD and base the substitute key off that however performance is a problem when that is done (1.6 million records). The delay is in the framwork side as it appears it processes the entire recordset when generating the concatenated substitute key.
Based on that I thought perhaps instead to simply generate a PXDimension configuration for this however I can't find any reference to make Dimension 2 rely on the value of Dimension 1.
I know i could always create a view that does this but i'd prefer to keep it within the framework if possible.
That basically brings me to two questions
1) Outside of a view, is there way to concatenate fields in the BQL so the lifting is done on the SQL and not with a calculated property?
2) Does anyone have or know of a sample of custom Dimensions where the values in level 2 depend on the value in level 1?
Any suggestions would be appreciated.
Out of the box, dimension selectors are designed to work only with Segmented Keys and won't be able to handle values from multiple tables. In theory, it can be possible to populate segment popup from different tables within a custom DimentionSelectorAttribute. However, this will additionally require to store each T1ID/T2ID pair in a separate table with some other column declared as a key (same concept used in the Sub table to store sub accounts: SubID is a key and SubCD stores values composed from multiple segments).
My personal opinion, the effort is just not worth it. Going one step further, I would check with the customer on how they expect navigation buttons (first, prev, next, last) to work with their segmented input control? If following standard Acumatica UI design with separate input created for every key field, no additional effort is needed to properly handle both data entry and navigation.

Difference Between Columns, metadata, keyword , field

I am a bit confused about terminology. In SharePoint we have a List and it consists of List columns but I have read in one of the site that this can be meta data too.
Taking an example if we have a SharePoint list and if we have a List Columns with name, Job description, age and Income, will this be termed as column, field or metadata?
If this is metadata then how can you define fields/columns/site column?
You may know that Meta Data is nothing but data about data.
In share point context Meta Data can be used as list column also. Consider any excel documents which are classified using Phase , Category, Document Type etc. So when ever you see these columns you can identify what kind of document it is.
As per my knowledge key words are nothing but taxonomy. By using these keywords you can classify the items.
Site Column is different. Site Column can be used as list column in any list. For eg. Consider the Age. In your site you are using Age column repeatedly in your lists/libraries. So instead of creating Age column in each list you can create only one site column and you can add to required list. In simple words reusable purpose.
Fields are nothing but a columns/site columns. These are related to list.
As Mihir states, the word "metadata" means "data about data". So to have metadata you need to have data. In SharePoint the most relevant example would be documents. Documents are data and you can have data (metadata) about these documents. Mihirs Excel example is an example of this.
Say, you want a document library in SharePoint and these documents have a document type chosen from a list of choices.
To achieve this you need to be able to put a document type on the documents. Since Document libraries in SharePoint is a special kind of list, you can create columns=fields on the list - and the data in these columns becomes metadata for your document.
So on the library you create a field, DocumentType, e.g. as a choice field. The field is setup with possible choices for the document type. So the list fields/columns are used to define metadata on the document(s).
When it comes to pure SP lists it becomes more difficult to talk about metadata. For what is it data about? In case of an employee I don't think you can define it as metadata, expect if you treat the physical person as "the data". However, I don't think it technical make a difference. You have your datamodel of the employees and implement it using SP lists - that's what they are there for!

"Not in" view for 1:N relationships

Assume we have an entity A which has a 1:N relationship with entity B. I want to create a view, that shows only records of A which has no entity B. A good example is, I want to view Quotes without Order.
Any solution with any complexity would be appreciated, such as plugin, script, silverlight...!
You would have to tackle it indirectly one way or another:
use a SSRS report and embed that where it would be needed (eg in a dashboard). This would have to use SQL rather than FetchXML, so this could only be a solution for CRM On-Premise, not Online
Use a workflow or plugin on create of record B1, or update of B1's parent lookup to entity A, which updates parent record "A1" with some arbitrary field (eg "date of first Order" or "Is converted to Order"). Now just build a standard advanced find query for new_field contains data, (or = 1 if it is a bit field). Depending on the exact scenario, you might need to actually use an integer count if records of entity B could be routinely deleted, or reparented to a different parent A2, so that you can increment / decrement as appropriate (so a reparent would inc the new one and dec the old).
Edit: Note that in CRM 2013 ("orion"), the FetchXML implementation does support this kind of construction for a view, but the Advanced Find tool (for example) does not provide a UI for it. See the answer to this question for more information:
View Showing Accounts that don't have contact
Use the Advanced Find and Select Quotes, then for the criteria select the Order lookup field
and choose the operator to be Does Not Contain Data. By this way, you'll get all records for entity B which have no parents of entity A.
Download the FetchXML and use it in your Plugin or Silverlight.
Edit:
I think the best way is to create an N:N relation with manually created intersect table.
And your query has to select target the intersect table.
As you might know, the intersect table links to both Entities A and B.
The criteria will be: selecting Intersect table where there is no reference to Entity B.

Avoiding "Unique field" conflicts in inheritance

My situation
I have an entity model with a base class ItemBase which defines an ID, a name and a few other properties. The "ID" column is the identity, the "Name" colum is an unique field in the base table. This base class is also defined as an abstract class. So yes, it is a table in the database, but in EF4 I cannot create instances of this base class.
And I have five different entities that inherit from the base class. (Item1, Item2...Item5) So all of them inherit the properties of ItemBase and additional properties are stored in an alternate table. One table per type. Quite nice, actually!
My problem
An object of type Item2 could have the same name as an object of Item5. This would cause a problem since they would both end up with a record in the ItemBase table, and the Name field would be in conflict. That's just nasty. So if the Item2 class contains brands of television manufacturers and Item5 contains lists of smartphone manufacturers then "Samsung" cannot be added in both entity sets.
I need a solution that will work around this problem, while keeping it simple. (And without adding the Name field to all child tables, because YUCK!) Suggestions?
Way to solve this?
Because "Name" is in the base table and defined as 'Unique', I will end up with conflicts when two different entity classes have the same name. I need a solution where "Name" is in the base table, yet it's unique per child class only, not unique for the base class...
I could alter the child entities to add a prefix to the name when writing to the table, and removing it again when reading from the table. Or I add another field to the base table indicating the child class linked to it, and make "name"+"link" unique, instead of just "Name". Both solutions aren't very pretty and it's unclear to me how to implement one of those. So is there a better solution or else, how do I implement this nicely?
It cannot be solved by unique column. The unique key would need to be placed over two columns - one specifying the Name and one specifying the type of derived entity but that is not possible with the inheritance type you selected (Table-per-type) because EF will not create and maintain that additional column for you. That would be possible only with Table-per-hierarchy inheritance where all five child entities are stored in the same table as base class and there is discriminator column to differ among them.
To solve this with your current design you must either use trigger on base table with some query logic to find if name is unique per child or handle this completely in your application.

Managing dates in Section Headers with Core Data

I have conceptual issue with using core data. My app lists events by title in the main tableview then navigates to a tableview which is unique to the event. Here it's supposed to display in the section headers of the tableview an event date, a list of dates that expand a range (requires calculation) or list of unique dates.
I have arranged this in the model with 3 entities. Event & Date have a one to one relationship. Date to Menu have a one to many relationship. Menu contains the data for events that have unique dates, Dates contains events that either have a start date or in some cases when it's a range an end date.
Ok if the above is clear my question is how do I do create a list of section headers unique to an event? Bear in mind that NSFetchedResultsController only provides the ability to return a section name from a managedObject. I think this is what's throwing me.
Do I fetch the data unique to the event then use FRC to create arrays to populate the section headers and live with the table not being managed? Or is there a smarter way?
I don't really understand your model but I think it looks something like this:
Event{
name:string
date<-->Date.event
}
Date{
event<-->Event.date
menus<-->>Menu.date
}
Menu{
date<<-->Date.menus
}
If this isn't correct, you might try editing the question with the data model in this format it can be better understood. (if you can't edit, just fold the format into a comment and I will add it. Alternatively, send it me in an email.)
I'm not clear on what data you want in your Event table section titles. Sections are intended to be groupings of managed objects based on some attribute of those objects. The canonical example would be Contact.app's contact list. The contacts are grouped based on alphabetical value of the first letter of the last name.
Once common mistake is to think of a section table as representing hierarchal objects with the section titles representing superior objects and the rows representing inferior e.g. yo have a model to simulate a file system so you have a Directory entity and a File entity. You try to set the section titles to the name of the Directory and the rows to the names of the related File entities. That would not work smoothly and would not really mesh with the interface grammar that the user has learned for section titles. Instead, you should have a hierarchy of tableviews with a table showing all Directory objects and then a second table view showing all the File objects related to the selected `Directory object.
So, if the section titles you want come from any object besides Event you are probably approaching the problem from the wrong angle.

Resources