I am using a Field Container to enter a new Contact information, and I would like to populate some of the fields with values.
I can do this for normal fields like Phone and LastName, but ti does not work for lookup fields like ReportsTo and Account.
This is th code I am using:-
var acc:DynamicEntity = new itemClass("Contact");
acc.Phone="8888";
acc.LastName="Nieddu Srl"
acc.ReportsTo ="0012000000RsJYb"
acc.Account="test"
_createFieldContainer.render(acc)
Is there any way to populate a lookup field with a default value when the field container is called??
Thanks
Roy
I can see a couple of issues here:
You need 'Id' on the end of your lookup fields - i.e. ReportsToId, AccountId
You need to supply a real object Id for Account.
So your code would look something like:
var acc:DynamicEntity = new itemClass("Contact");
acc.Phone = "8888";
acc.LastName = "Nieddu Srl";
acc.ReportsToId = "0012000000RsJYb";
acc.AccountId = "00123400000RHEG";
_createFieldContainer.render(acc);
Related
I promise I have read through the Query information page, but obviously I am missing/misunderstanding something.
I have a Table that has the statuses for multiple departments (the fields are Strings). When a user loads that table I want App Maker to hide jobs that have been finished.
The way we categorize a job as finishes is when:
The Inventory Status = Complete and when the The Delivery Status = Delivered.
Both these conditions need to be met.
Example:
Inventory (Complete) + Delivery (Delivered) = hide
Inventory (In Progress) + Delivery (Delivered) = don't hide
Inventory (Complete) + Delivery (Scheduled) = don't hide
I tried the following, however it hides all the example listed above, not just the first one.
var datasource = app.datasources.SystemOrders;
var inventory = ['Complete'];
var delivery = ['Delivered'];
datasource.query.filters.InventoryStatus._notIn = inventory;
datasource.query.filters.DeliveryStatus._notIn = delivery;
datasource.load();
I have also tried this:
var datasource = app.datasources.SystemOrders;
datasource.query.filters.InventoryStatus._notIn = 'Complete';
datasource.query.filters.DeliveryStatus._notIn = 'Delivered';
datasource.load();
But I get this error:
Type mismatch: Cannot set type String for property _notIn. Type List is expected. at SystemOrders.ToolBar.Button2.onClick:2:46
Any help would be greatly appreciated.
Filters are using AND operator. Please consider switching the Datasource Query Builder and applying the following query:
"InventoryStatus != :CompleteStatus OR DeliveryStatus != :DeliveredStatus"
Set CompleteStatus variable to Complete
Set DeliveredStatus variable to Delivered
Explanation:
Filter you want to apply is "NOT(InventoryStatus = Complete AND DeliveryStatus = Delivered)" which is equivalent to "InventoryStatus != Complete OR DeliveryStatus != Delivered".
Vasyl answer my question perfectly, but I wanted to add a few details in case anyone needs to do the same thing and aren't familiar with using the Datasource Query Builder.
All I did was click the Database I was using and then clicked the Datasources section at the top.
I clicked Add Datasource, named it a new name and pasted Vasyl's code into the Query Builder Expression box.
Two new boxes appear below it allowing me to enter the desired statuses that I wanted to filter out.
Lastly I went back to my Table and changed its datasource to my newly created datasource.
Since you are changing your datasource, if you have any extra code on there it may need to be updated to point to the new datasource.
Example:
I had some buttons that would filter entries for the various departments.
So this:
widget.datasource.query.clearFilters();
var datasource = app.datasources.SystemOrders;
var statuses = ['Complete'];
datasource.query.filters.WarehouseStatus._notIn = statuses;
datasource.load();
had to change to this:
widget.datasource.query.clearFilters();
var datasource = app.datasources.SystemOrders_HideComplete;
var statuses = ['Complete'];
datasource.query.filters.WarehouseStatus._notIn = statuses;
datasource.load();
You can use multiple run and then concatenate their results something like following
/**
* Retrieves records for ActionItems datasource.
* #param {RecordQuery} query - query object of the datasource;
* #return {Array<ActionItems>} user's rating as an array.
*/
function getActionItemsForUser_(query) {
var userRoles = app.getActiveUserRoles();
query.filters.Owner._contains = Session.getActiveUser().getEmail();
var ownerRecords = query.run();
query.clearFilters();
query.filters.AddedBy._contains = Session.getActiveUser().getEmail();
var addedByRecords = query.run();
return addedByRecords.concat(ownerRecords);
}
when i add to cart
i using Session["Cart"] = new List() { Id }; which is get the id pass from the query string
but when i preview on the cartview event i add 2/3 product, it only will show 1 column, which is the latest. why it will replace? my code look like. how should i do to make sure every time i add it will be display on the view cart page? if this code problem or my cart preview page have probelm?
Try this example ,
string[] a = new string[]{"a","b","c"};
Session["values"] = a;
And you can retrieve it like this.
string[] a = (string[])Session["values"]
using List
Session["test"] = yourList;
And you can retrieve it like this.
var list = (List<string>)Session["test"];
I created some Appointments in VB.NET with EWA. It works fine. Now i want to edit the appointment ( date or topic).
for every booking I saved the booking ID in a extended property from the appointment
' Create a definition for the extended property.
Dim extendedPropertyDefinition As New EWS.ExtendedPropertyDefinition(EWS.DefaultExtendedPropertySet.Appointment, EWS.MapiPropertyType.String)
' Add the extended property to an e-mail message object named "appointment".
appointment.SetExtendedProperty(extendedPropertyDefinition, buchungId)
How can I select a appointment with the correct bookingid and edit the topic for example?
you can search by items with the Extended property. Your code may look like this (hope c#-Code helps you too, I'm a bit out of practise in VB):
ExtendedPropertyDefinition prop = new ExtendedPropertyDefinition(Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet.PublicStrings, <Name>, MapiPropertyType.String);
SearchFilter filter = new SearchFilter.IsEqualTo(prop, "SearchValue");
FolderId folder = new FolderId(WellKnownFolderName.Inbox)
FindItemsResults<Item> result = service.FindItems(folder, filter, new ItemView(10));
If your "buchungid" is unique, result.Items should have one item if it's in the inbox.
Hey all, I was able to do this via a SELECT CASE statement, however I'm always trying to improve my code writing and was wondering if there was a better approach. Here's the scenario:
Each document has x custom fields on it.
There's y number of documents
However there's only 21 distinct custom fields, but they can obviously have n different combinations of them depending on the form.
So here's what I did, I created an object called CustomFields like so:
Private Class CustomFields
Public agentaddress As String
Public agentattorney As String
Public agentcity As String
Public agentname As String
Public agentnumber As String
Public agentstate As String
Public agentzip As String
... more fields here ....
End Class`
Then I went ahead and assigned the values I get from the user to each of those fields like so:
Set All of Our Custom Fields Accordingly
Dim pcc As New CustomFields()
pcc.agentaddress = agent.address1
pcc.agentattorney = cplinfo.attorneyname
pcc.agentcity = agent.city
pcc.agentname = agent.agencyName
pcc.agentnumber = agent.agentNumber
pcc.agentstate = agent.state
pcc.agentzip = agent.zip ....other values set to fields etc.
Now the idea is based upon what combo of fields come back based upon the document, we need to assign the value which matches up with that custom field's value. So if the form only needed agentaddress and agentcity:
'Now Let's Loop Through the Custom Fields for This Document
For Each cf As vCustomField In cc
Dim customs As New tblCustomValue()
Select Case cf.fieldname
Case "agentaddress"
customs.customfieldid = cf.customfieldid
customs.icsid = cpl.icsID
customs.value = pcc.additionalinfo
Case "agentcity"
customs.customfieldid = cf.customfieldid
customs.icsid = cpl.icsID
customs.value = pcc.additionalinfo
End Select
_db.tblCustomValues.InsertOnSubmit(customs)
_db.SubmitChanges()
This works, however we may end up having 100's of fields in the future so there a way to somehow "EVAL" (yes I know that doesn't exist in vb.net) the cf.fieldname and find it's corresponding value in the CustomFields object?
Just trying to write more efficient code and looking for some brainstorming here. Hopefully my code and description makes sense. If it doesn't let me know and I'll go hit my head up against the wall and try writing it again.
If I am reading your question correctly, you are trying to avoid setting the value of fields, when the field isn't used. If so, I would recommend you just go ahead and set the field to nothing in that case.
I have a DataGridView binded to this table:
[Users]
ID Name
-- ----
11 Qwe
22 Asd
Grid is direclty binded to typed dataset table.
I have a second table like this:
[Records]
ID UserID Data
-- ------ ----
67 11 ....
68 11 ....
Records.UserID is connected to Users with a foreign key.
What I want to do is: when the user doubleclicks User #11 I open a new grid, binded to [Records] table but only binded to rows where UserID = 11. Doubleclick, getting ID, new grid etc. those are OK. I wouldn't had any problems if I was doing this connected with sprocs but I want it to be binded and I simply have no idea how to do this.
Can you please give me any ideas?
If you are using DataSets/DataTables, then you can do something like this to filter your rows for the second grid:
string filter = String.Format("UserID = {0}", selectedUserId);
grdRecords.DataSource = ds.Tables["Records"].Select(filter);
I believe you can edit the records in the array that is returned, but you won't be able to add/remove new items to this collection. You would have to add them to the regular table, then refilter the grid.
Of course, there's all kinds of other ways to do this as well. If you are using objects that derive from IBindingListView, such as instances of the DataView class, you should have access to the Filter property. Then you can just do this:
string filter = String.Format("UserID = {0}", selectedUserId);
DataView myView;
grdRecords.DataSource = myView;
myView.Filter = filter;
And your view will stay filtered to match whatever data you place into it.
Hopefully, this post is clear enough for you to be able to work out the details... I'm a little scatterbrained today. :)
In the end I had to this:
Create a DB class, with a public property (MyDataSetProperty) that returns the typedDataset
Create a custom Fill function in DataSet that accepts an Id parameter.
Use this function to fill the table in the private typedDataset
this.myTableAdapter.FillCustom(this.myTypedDataset.MyTable, this.Id);
Bind bindingSource to this public property:
this.bindingSource.DataSource = this.db.MyDataSetProperty;