Movilizer - Masterdata referencing modification - mobile

We have a big masterdata pool of customers. With group references.
Customer "key1" is in groups "G2 and G3" (using the tag).
How can I change this references if for instance now I need customer to be in "G1 and G4" instead of "G2 and G3".
Do I have to delete the key, create it again and set the new references to G1 and G4 ... or ....
Is there a way to remove a reference and set another one?
Edit
Let's assume this is how I created the masterdata plus references:
<masterdataPoolUpdate pool="P1">
<update key="key1" group="G2"><description>key1Desc</description>
</update>
<reference key="key1" group="G3" />
</masterdataPoolUpdate>

Ok I think I managed to figure it ... first I need to remove the original entry in G2 (and also the reference). Then I need to create the entry in G1 or G4 and add a new reference accordingly:
<masterdataPoolUpdate pool="P1">
<delete key="key1" /> <!-- delete key1 and its references -->
<update key="key1" group="G1"><description>key1Desc</description></update>
<reference key="key1" group="G4" />
</masterdataPoolUpdate>

Step 1: send two new updates to enhance the reference on this groups named G1 and G4. The customer will now have access on this groups.
Step 2: remove the reference for the customer of group G2 and G3 by sending two deletes

Related

Read Only Table displays foreign key instead of details

Summarize the problem
So I have a Department Table which has a column Location ID which references a Location Table.
FYI: (Department.locationID = Location.LocationID)
Now on my UI page when I drag and drop the department collection to make a table it displays the locationID instead of the location name. My end users won't understand Location ID, they'll need to see the locationName.
Provide background including what you've already tried
On my Department VO, I have referenced the locationID to a LOV so that it displays the LocationName. When the table is updatable, I have no issues, but when the table is read only the ID is being displayed instead of name.
I have read few blogs where they suggest to make the table column SelectOneChoice. Find the code snippet taken from my jsf page below.
Show some code
<af:column headerText="#{bindings.Departments1.hints.DepartmentLocationId.label}" id="c6">
<af:selectOneChoice value="#{row.DepartmentLocationId}"
shortDesc="#{bindings.Departments1.hints.DepartmentId.tooltip}"
id="soc1" readOnly="true">
<af:convertNumber groupingUsed="false" pattern="#{bindings.Departments1.hints.DepartmentLocationId.format}"/>
</af:selectOneChoice>
<!-- <af:outputText value="#{row.DepartmentLocationId}"
shortDesc="#{bindings.Departments1.hints.DepartmentLocationId.tooltip}" id="ot6">
<af:convertNumber groupingUsed="false" pattern="#{bindings.Departments1.hints.DepartmentLocationId.format}"/>
</af:outputText> -->
</af:column>
Describe expected and actual results including any error messages
After making the above changes (I commented out "outputText" section and added the "selectOneChoice" section) my location column doesn't display anything.
My expected output is for the table to display Location Name and not locationID.
I'm using JDeveloper 12c.
So just in case, anyone else faces the same issue, here is what I did as a workaround. It's not the exact solution to the above problem, but it works.
Instead of relying on VO based on one EO, I made a VO that's based on two EOs. the DepartmentEO and LocationEO. In the VO layer, both EOs should also be related with an association.
Now my DepartmentVO has an extra attribute called LocationName. On the UI front, I hide my LocationID and instead display the LocationName.

How to create a table in adf with variable no of columns

Hello I am developing a web application using ADF (jdeve11.1.2.4). I know how to populate a table programatically from this post Programmatic ADF Table
But in the above post the no of columns are fixed (It is bean structure). But I cannot use the above post. Because I need to create a table with 'n' no-of columns. Means Columns are not fixed. Some times the columns may be 4 or some times the columns may be 7 and what ever it may be. Suppose I have two sqls and both contains differnt no of columns.
Ex: (suppose student is a table)
select id from student
select id,name from student
so in the above two sqls no of columns are diffent. I need to show the resul set of the above queries in a tablular format.
Please help me how I can achieve this.
Thanks in advance.
I wonder if declarative mode view objects would help? Blog here. So the query is not built until the UI is gen'd. You could dynamically generate the table and insert columns and then bind to the VO.
That's quite complex to do and it may require some extra study:
create a programatic view object by passing your sql statement using:
ApplicationModuleImpl.createViewObjectFromQueryStmt(java.lang.String voName,java.lang.String query)
try to construct af:columns in a loop:
<af:table value="#{bindings.EmployeesView1.collectionModel}" .. id="t1">
<af:iterator id="i1" value="#{bindings.EmployeesView1.attributesModel.attributes}" var="column" rows="0">
<af:column headerText="#{column.label}" id="c1">
<af:outputText id="d1" attributeModel="#{column}" value="#{row.bindings[column.name].inputValue}" />
</af:column>
</af:iterator>
</af:table>

Facing issue while inserting lookup type record in salesforce: mule esb

I am facing issue while inserting record in salesforce.
Type of record is lookup(Account) and field name is site_id.I insert csv file record into salesforce. But because of this record(data type(lookup)) i can not insert record in salesforce. If I change type of record to Text than i can insert. But I need lookup(Account) type.
How is it possible ...please help me
following is my flow
<batch:job name="testsalesforceBatch1">
<batch:input>
<file:inbound-endpoint path="CustomFile" responseTimeout="10000" doc:name="File"/>
<data-mapper:transform config-ref="CSV_To_List_Report__c__1" doc:name="CSV To List<Report__c>"/>
</batch:input>
<batch:process-records>
<batch:step name="Batch_Step">
<batch:commit size="1000" doc:name="Batch Commit">
<sfdc:create-bulk config-ref="Salesforce" type="Report__c" doc:name="Salesforce">
<sfdc:objects ref="#[payload]"/>
</sfdc:create-bulk>
</batch:commit>
</batch:step>
</batch:process-records>
<batch:on-complete>
<logger message="#[payload.totalRecords]" level="INFO" doc:name="Logger"/>
</batch:on-complete>
</batch:job>
I got following error...
[SaveResult errors='{[1][Error fields='{XXXXXXX,}'
message='XXXXXX: id value of incorrect type: 000'
statusCode='MALFORMED_ID'
]
NOTE: 000 value is available in Account table
I got answer..how to insert lookup data type record in salesforce through mule.
Use recordId to store that value...
Thanks
For Salesforce Integrations there are two ways to insert/upsert/create fields with lookup values.
Way 1: Use the actual ID of the lookup target. So if you are going to lookup an Account, you first need to get the ID of the Account you are targeting, then use that ID in the field as a "String" in data mapper.
Way 2: Use a External ID on Account and upsert the new record referring to the external ID. This is a little more complicated but is very excellent way to not have to do two API calls.
In Datamapper then, you need to have Account be listed as an Element and not as an Attribute. This has to be done manually as Datamapper won't know to do this on its own.
Account (Element)
|-type (String) -> 'Account' *this is just a fixed string*
|-ExternalIdFieldName__c (String) -> external_id_from_datasource
Since Account is a standard SalesForce object it doesn't have a __c or __r after it, if it was a custom object and you are doing a lookup it changes a little bit.
Objects:
MyCustomAccount__c
External ID in above: AccountExternalId__c
Lookup field: AccountLookup__c (lookup to Account from Contact)
In Datamapper then you have:
AccountLookup__r (Element) *notice the __r instead of __c*
|- type (String) -> 'MyCustomAccount__c' *this is just a fixed string*
|- AccountExternalId__c (String) -> externalidfieldfromcsv

Stored procedure mapping for many-to-many association

I have a relatively simple table of Terms, and each Term can have multiple parents and children so there is a TermAssociation table.
Term TermAssociation
---- ---------------
TermID ParentTermID
TermName ChildTermID
...
When mapped in EF, this generates a Term entity with a many-to-many association with itself. Everything's cool.
The problem is I work in an environment where all table updates must go through stored procedures. I can use stored procedure mapping just fine for the Term entity, but how do I map an SP to the TermAssociation table since it's modeled as an association and not an entity?
I haven't found a way to do this through the designer, but it is possible if you edit the XML of the edmx file directly. Find the association set mapping:
<AssociationSetMapping Name="TermAssociation" TypeName="TCPDataDictionaryModel.TermAssociation" StoreEntitySet="TermAssociation">
<EndProperty Name="Term">
<ScalarProperty Name="TermId" ColumnName="ParentTermId" />
</EndProperty>
<EndProperty Name="Term1">
<ScalarProperty Name="TermId" ColumnName="ChildTermId" />
</EndProperty>
</AssociationSetMapping>
Then add a ModificationFunctionMapping inside the AssociationSetMapping. InsertAssociation is my insert SP and it takes #ParentTermId and #ChildTermId as parameters.
<ModificationFunctionMapping>
<InsertFunction FunctionName="TCPDataDictionaryModel.Store.InsertAssociation" >
<EndProperty Name="Term">
<ScalarProperty Name="TermId" ParameterName="ParentTermId" />
</EndProperty>
<EndProperty Name="Term1">
<ScalarProperty Name="TermId" ParameterName="ChildTermId" />
</EndProperty>
</InsertFunction>
</ModificationFunctionMapping>

Database structure: how to best design for this issue?

I have users that have several objects and can upload images for those objects. Each object has several items. The photos the user upload can be assigned to those items. The thing is, one object can have one specific item more than once.
To give an example: objects are cars and items are seats, windows, doors, etc. A car may have 5 seats, but all seats are the same item. The description of the image should, however, still be "seat 1", "seat 2", etc. and the user can upload multiple images for seat 2 as well.
Till now I have the following tables:
objects: id, name
items: id, name
assigned_items: id, object_id, item_id, quantity
images: id, object_id, item_id
How would you best solve this issue?
The reason I use quantity is, because if type of the item changes, then most probably of all the items. E.g. 4 seats can become 4 wheels, etc. So, if there was a row for each assigned_item, lets say seat1, seat2, seat3, etc, then this would be more difficult to change, no?
Take a look at this model:
It allows you to:
Connect multiple items to multiple objects (thanks to OBJECT_ITEM table).
Connect the same item multiple times to the same object (thanks to OBJECT_ITEM.POSITION field).
Connect multiple images to an object-item connection (thanks to OBJECT_ITEM_IMAGE table). So, we are connecting to a connection, not directly to an item.
Name the image specific to the object-item connection (thanks to OBJECT_ITEM_IMAGE.IMAGE_NAME field), instead of just specific to the image.
Ensure image name is unique per object-item connection (thanks to UNIQUE constraint "U1").
NOTE: This model can be simplified in case OBJECT:ITEM relationship is 1:N instead of the M:N, but your own attempted model seems to suggest it is M:N.
NOTE: To connect an image directly to OBJECT (instead of OBJECT_ITEM), you'd need additional link table (OBJECT_IMAGE) in "between" OBJECT and IMAGE.
Example data:
OBJECT:
Car
ITEM:
Seat
OBJECT_ITEM:
Car-Seat-1
Car-Seat-2
Car-Seat-3
Car-Seat-4
Car-Seat-5
OBJECT_ITEM_IMAGE:
Car-Seat-1-Image1 "Seat1 Image"
Car-Seat-2-Image1 "Seat2 Image"
Car-Seat-2-Image2 "Seat2 Alternate Image"
Car-Seat-3-Image1 "Seat3 Image"
Car-Seat-4-Image1 "Seat4 Image"
Car-Seat-5-Image1 "Seat5 Image"
IMAGE:
Image1
Image2
Unless you actually mean that items can belong to multiple objects, using assigned_items is not helpful. If I understand you correctly, your main concern is that you sometimes have images that are for part of an item, so how do you describe the image?
Here is what I suggest:
OBJECT: id, name
ITEM: id, name, quantity, object_id
IMAGE: id, name (null), object_id (null), item_id (null)
If your DBMS supports constraints, have a constraint on IMAGE to enforce one or the other of object_id or item_id (but not both). This allows you to define the image as being either for an item or for the object as a whole.
When you query for the name of an image, you would use the COALESCE function (or your DB's equivalent) to pick up the image override name (if it exists) or the object/item name (if the override doesn't exist).

Resources