How to retrieve parentaccountid from account using queryexpression and silverlight - silverlight

My query returns account.name, account.account and account.parentaccountid.
I'm using Silverlight and CRM2011.
Now I'm having trouble to find out how to extract value from parentaccountid attribute.
I have silverlightextensionmethods.cs file included in my VS project, and I'm using GetAttributeValue<Guid>("parentaccountid") to get the value from parentaccountid.
The value returned is empty.
Has anyone any ideas how to accomplish this?
I can get any other attribute value, but parentaccountid in account and parentcustomerid in contact are making my life very difficult.
Code:
FIRST I CREATE QUERYEXPRESSION:
string temp="name;accountid;parentaccountid";
string[] fields = temp.Split(';');
QueryExpression query = new QueryExpression()
{
EntityName = entity,
ColumnSet = new ColumnSet { Columns = new System.Collections.ObjectModel.ObservableCollection<string>(fields) },
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = parentidfield,
Operator = ConditionOperator.Equal,
Values = { id }
}
}
}
};
OrganizationRequest req = new OrganizationRequest();
req.RequestName = "RetrieveMultiple";
req["Query"] = query;
service.BeginExecute(req, new AsyncCallback(GetChildren_ExecuteCallBack), service);
NEXT I TY TO READ VALUES FORM RESPONSE
void GetChildren_ExecuteCallBack(IAsyncResult childresult)
{
List<TreeRecord> listc = new List<TreeRecord>();
try
{
OrganizationResponse childresponse = ((IOrganizationService)childresult.AsyncState).EndExecute(childresult);
EntityCollection childresults = (EntityCollection)childresponse["EntityCollection"];
if (childresults.Entities.Count > 0)
{
TreeConfig sitm = new TreeConfig();
string sdisplay = "";
string[] fields = "".Split(';');
string sid = "";
string pid = "";
foreach (Entity childentity in childresults.Entities)
{
foreach (TreeConfig sitem in Configs)
{
if (sitem.EntityName == childentity.LogicalName)
{
sitm = sitem;
}
}
TreeRecord childitem = new TreeRecord();
string sValue = "";
sdisplay = "name;accountid;parentaccountid";
fields = sdisplay.Split(';');
sid = "accountid";
pid = "parentaccountid";
int i = sdisplay.Split(';').Length;
for (int j = 0; j < i; j++)
{
try { sValue += childentity.GetAttributeValue<string>(fields[j]) + " "; }
catch (Exception ex)
{
//s = "sValue haku: " + ex.Message.ToString();
//this.ReportMessage(s.ToString());
}
}
childitem.Name = sValue;
childitem.EntityName = childentity.LogicalName;
childitem.Level = sitm.Level;
childitem.ParentEntityName = sitm.EntityName;
childitem.Color = sitm.Color;
childitem.RecordId = childentity.GetEntityId<Guid>(sid);
try { childitem.ParentId = childentity.GetAttributeValue<Guid>(pid); }
catch
{
//sb.AppendLine("guid: parentid tietoa ei löydy");
//this.ReportMessage(sb.ToString());
}
listc.Add(childitem);
}
}
}

Instead of
childentity.GetAttributeValue<Guid>(pid)
use
childentity.GetAttributeValue<EntityReference>(pid)

Related

Test class coverage not increasing after 71 %. "Bold Italic part is not covering in Test class."

enter image description hereThe trigger is working completely fine, but Its not giving 100% code coverage. The main issue with Test class, its not covering the if condition of Role__c.
Trigger:
trigger DrawingSharing on Drawing__c (after insert) {
if(trigger.isInsert){
for (Drawing__c draw : Trigger.new){
System.debug('draw: '+draw);
List<Installation__c> ListInstalltionList = new List <Installation__c>();
for(String installationActivityList :draw.Installation_Activity__c.split(';')){
Installation__c inst = new Installation__c();
inst.Drawing_ID__c = draw.Id;
inst.Installation_Activity__c=installationActivityList;
inst.Execution__c=draw.Execution_ID__c;
inst.Floor__c=draw.Floors__c;
ListInstalltionList.add(inst);
}
system.debug('ListInstalltionList==>'+ListInstalltionList);
insert ListInstalltionList;
List<Drawing__c> newList = new List<Drawing__c>();
newList.add(draw);
Map <Id,Id> DrawingProjectMap = new Map<Id,Id>();
Map<Id,Drawing__c> drawingIdObjMap = new Map<Id,Drawing__c>([select id, name,Approver__c, Execution_ID__r.Project__c from Drawing__c where id in :newList limit 1]);
for(Drawing__c Drawing : drawingIdObjMap.values())
{
DrawingProjectMap.put(Drawing.Id,Drawing.Execution_ID__r.Project__c);
}
system.debug(DrawingProjectMap);
Map<Id,RoleObjectSharing__mdt> roleobjaccessmap = new Map<Id,RoleObjectSharing__mdt>([select id,Object__c,role__c,Accesslevel__c from RoleObjectSharing__mdt where Object__c='Drawing']);
Map<String,String> RoleAccessmap = new Map<String,String>();
for(RoleObjectSharing__mdt Robj : roleobjaccessmap.values()){
RoleAccessmap.put(Robj.role__c,Robj.Accesslevel__c);
}
system.debug(RoleAccessmap.keySet());
system.debug(DrawingProjectMap.values());
Map<Id,Projects__c> teamrolemap = new Map<Id,Projects__c>([select Id,(select id, User_Lookup__c,Role__c from TeamRoles__r where Role__c in:RoleAccessmap.keySet()) from Projects__c where Id in :DrawingProjectMap.values()]);
system.debug('teamrolemap'+teamrolemap);
List <Drawing__Share> DrawShareList = new List<Drawing__Share>();
List <Drawing__c> DrawList = new List<Drawing__c>();
INTEGER countFound = 0;
for(Drawing__c drawobj : newList){
Projects__c proj = teamrolemap.get(DrawingProjectMap.get(drawobj.id));
system.debug(proj.teamroles__r);
***for(teamroles__c tr : proj.teamroles__r){
system.debug(tr);
if(tr.Role__c == 'PlanningEngineer' || tr.Role__c == 'AssistantPlanningEngineer' || tr.Role__c == 'PlanningManager' || tr.Role__c == 'AssistantPlanningManager' && countFound <=0) {
countFound = countFound + 1;
Drawing__c ddd = drawingIdObjMap.values();
ddd.Approver__c = tr.User_Lookup__c;
DrawList.add(ddd);
}
Drawing__Share recruiterShr = new Drawing__Share();
recruiterShr.ParentId = drawobj.Id;
recruiterShr.UserOrGroupId = tr.User_Lookup__c;
recruiterShr.AccessLevel = RoleAccessmap.get(tr.role__c);
recruiterShr.RowCause = tr.role__c+'__c';
DrawShareList.add(recruiterShr);***
}
system.debug(DrawShareList);
}
upsert DrawList;
Database.SaveResult[] lsr = Database.insert(DrawShareList,false);
Integer i=0;
for(Database.SaveResult sr : lsr){
if(!sr.isSuccess()){
}
i++;
}
}
}
}
Test Class:
static testMethod void Test4(){
System.debug('TestSharing = Test4');
Test.startTest();
Projects__c proj = new Projects__c();
proj.Name = 'Hello';
proj.LL_Location__c='Mumbai';
insert proj;
TeamRoles__c tr1 = new TeamRoles__c();
tr1.User_Lookup__c = UserInfo.getUserId();
tr1.Role__c = 'PlanningEngineer';
tr1.Project_Name__c = proj.Id;
insert tr1;
TeamRoles__c tr2 = new TeamRoles__c();
tr2.User_Lookup__c = UserInfo.getUserId();
tr2.Role__c = 'PlanningManager';
tr2.Project_Name__c = proj.Id;
insert tr2;
Execution__c ex = new Execution__c();
ex.Project__c = proj.Id;
insert ex;
Item_Master__c ItemeMaster = new Item_Master__c();
ItemeMaster.Item_Description__c = 'testing';
ItemeMaster.Item_Code__c = 'testing';
insert ItemeMaster;
Project_Items__c projItems = new Project_Items__c();
projItems.Total_PO_Quantity__c = 0;
projItems.ItemMaster__c = ItemeMaster.Id;
projItems.Execution__c = ex.Id;
insert projItems;
List<TeamRoles__c> lstTR = new List<TeamRoles__c>();
TeamRoles__c tr7 = new TeamRoles__c();
tr7.User_Lookup__c = UserInfo.getUserId();
tr7.Role__c = 'PlanningEngineer';
tr7.Project_Name__c = proj.Id;
lstTR.add(tr7);
List<Drawing__c> d= new List<Drawing__c>();
Drawing__c draw = new Drawing__c();
draw.Execution_Id__c = ex.Id;
draw.Floors__c='5F';
draw.Installation_Activity__c='Cable Tray';
draw.Drawing_Line_Items_Count__c = 0;
d.add(draw);
insert d;
//insert draw;
Installation__c inst = new Installation__c();
inst.Drawing_ID__c=draw.Id;
inst.Floor__c= draw.Floors__c;
inst.Installation_Activity__c='Cable Tray';
inst.As_built_Marked_Drawing_Prepared_by_Site__c =False;
inst.Execution__c = ex.Id;
insert inst;
SharingUtilityClass suc = new SharingUtilityClass();
suc.initObjSharing(lstTR);
Drawing_Line_Items__c dll = new Drawing_Line_Items__c();
dll.Drawing_Number__c = draw.Id;
dll.Project_Items__c = projItems.Id;
dll.Project_Name__c = proj.Id;
dll.Installation_Activity__c='Cable Tray';
dll.GFC_Quantity__c = 15;
dll.Shop_Drawing_Quantity__c = 20;
dll.GFC_Drawing_Line_Item_Done__c = true;
dll.Shop_Drawing_Line_Item_Done__c=true;
insert dll;
Installation_Line_Items__c instline = new Installation_Line_Items__c();
instline.Installation__c = inst.Id;
instline.Project_Items__c = projItems.Id;
instline.Installation_Activity__c='Cable Tray';
instline.Total_installed_quantity_DPR_Quantity__c = 100.00;
insert instline;
List<Drawing_Line_Items__c> listProj2 = CircularProgressController.getDrawingLineItem(dll.Id);
List<Drawing_Line_Items__c> listProj3 = CircularProgressController.getDrawingLineItemShop(dll.Id);
List<Drawing__c> listProj4 = Drawing.getDrawing(draw.Id);
List<Project_Items__c> listProj5 = Drawing.getProjectItems(ex.Id);
Test.stopTest();
}
If there are team roles being debugged from this line
for(teamroles__c tr : proj.teamroles__r){
system.debug(tr);
I would then check to see if this is evaluating to true within the test context:
if(tr.Role__c == 'PlanningEngineer' || tr.Role__c == 'AssistantPlanningEngineer' || tr.Role__c == 'PlanningManager' || tr.Role__c == 'AssistantPlanningManager' && countFound <=0)

Not able to update the data in more than one table in Asp .net MVC5

Here I am able to add the data in more than one table. Let i have 3 tables User, Franchise and Fee.
I am not able to update the data in more than one table,it throwing the exception:
A referential integrity constraint violation occurred: The property value(s) of 'User.Id' on one end of a relationship do not match the property value(s) of 'Franchise.UserId' on the other end.
Code:
public MessageResult SaveAndUpdateFranchisee(UserViewModel model)
{
var result = new MessageResult();
try
{
User userData = new User();
Franchise franchiseData = new Franchise();
var ExistUser = db.Users.Where(a => a.Id == model.Id).FirstOrDefault();
//Update record
if (model.Id > 0)
{
Fee feeData = new Fee
{
FranchiseeFee = model.FranchiseeFee,
PaymentTermsFranchiseFee = model.PaymentTermsFranchiseFee,
EquipmentCost = model.EquipmentCost,
PaymentTermsEquipmentCost = model.PaymentTermsEquipmentCost,
OtherFee = model.OtherFee,
PaymentTermsOtherFee = model.PaymentTermsOtherFee,
ConsumableStock = model.ConsumableStock,
PaymentTermsConsumableStock = model.PaymentTermsConsumableStock,
FrozenFoodStock = model.FrozenFoodStock,
PaymentTermsFrozenFoodStock = model.PaymentTermsFrozenFoodStock,
TotalAmountDue = model.TotalAmountDue,
TotalAmountPaid = model.TotalAmountPaid,
BalanceAmount = model.BalanceAmount,
LoyaltyFeePercentage = model.LoyaltyFeePercentage,
FixedMonthlyFee = model.FixedMonthlyFee,
Note = model.Note,
UserId = model.CurrentUserId,
LOIDocUrl = model.LOIDocUrl,
ModifiedDate = DateTime.Now
};
ExistUser.Email = model.Email;
//var pwd = SecutiryServices.EncodePasswordToBase64(model.Password);
//userData.Password = pwd;
ExistUser.Password = model.Password;
ExistUser.FirstName = model.FirstName;
ExistUser.MiddleName = model.MiddleName;
ExistUser.LastName = model.LastName;
ExistUser.FullName = model.FullName;
ExistUser.MobileNo = model.MobileNo;
ExistUser.ModifyDate = DateTime.Now;
franchiseData.Name = model.FullName;
franchiseData.MobileNo = model.MobileNo;
franchiseData.AlternateNo = model.AlternetNo;
franchiseData.CompanyPhoneNo = model.PhoneNo;
franchiseData.Address = model.Address;
franchiseData.City = model.City;
franchiseData.State = model.State;
franchiseData.PinCode = model.PinCode;
franchiseData.CompanyName = model.CompanyName;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyCity = model.CompanyCity;
franchiseData.CompanyState = model.CompanyState;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyPinCode = model.CompanyPinCode;
franchiseData.ModifiedDate = DateTime.Now;
userData.Franchises.Add(franchiseData);
foreach (var item in userData.Franchises)
{
item.Fees.Add(feeData);
}
db.Users.Attach(userData);
db.Entry(userData).State = System.Data.Entity.EntityState.Modified;
//db.Users.Add(userData);
db.SaveChanges();
result.Message = "Your franchise has been updated successfully..";
result.Status = true;
}
//For Insert recored..
else
{
Fee feeData = new Fee
{
FranchiseeFee = model.FranchiseeFee,
PaymentTermsFranchiseFee = model.PaymentTermsFranchiseFee,
EquipmentCost = model.EquipmentCost,
PaymentTermsEquipmentCost = model.PaymentTermsEquipmentCost,
OtherFee = model.OtherFee,
PaymentTermsOtherFee = model.PaymentTermsOtherFee,
ConsumableStock = model.ConsumableStock,
PaymentTermsConsumableStock = model.PaymentTermsConsumableStock,
FrozenFoodStock = model.FrozenFoodStock,
PaymentTermsFrozenFoodStock = model.PaymentTermsFrozenFoodStock,
TotalAmountDue = model.TotalAmountDue,
TotalAmountPaid = model.TotalAmountPaid,
BalanceAmount = model.BalanceAmount,
LoyaltyFeePercentage = model.LoyaltyFeePercentage,
FixedMonthlyFee = model.FixedMonthlyFee,
Note = model.Note,
UserId = model.CurrentUserId,
LOIDocUrl = model.LOIDocUrl,
CreatedDate = DateTime.Now
};
userData.Email = model.Email;
//var pwd = SecutiryServices.EncodePasswordToBase64(model.Password);
//userData.Password = pwd;
userData.Password = model.Password;
userData.FirstName = model.FirstName;
userData.FullName = model.FirstName + " " + model.LastName;
userData.LastName = model.LastName;
userData.MobileNo = model.MobileNo;
userData.IsActive = true;
userData.IsDelete = false;
userData.CreatedDate = DateTime.Now;
userData.UserTypeId = 2;
franchiseData.CompanyId = model.CurrentUserId;
franchiseData.Name = userData.FullName;
franchiseData.MobileNo = model.MobileNo;
franchiseData.AlternateNo = model.AlternetNo;
franchiseData.Address = model.Address;
franchiseData.City = model.City;
franchiseData.State = model.State;
franchiseData.PinCode = model.PinCode;
franchiseData.CompanyName = model.CompanyName;
franchiseData.CompanyPhoneNo = model.PhoneNo;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyCity = model.CompanyCity;
franchiseData.CompanyState = model.CompanyState;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyPinCode = model.CompanyPinCode;
franchiseData.CreatedDate = DateTime.Now;
franchiseData.IsActive = true;
userData.Franchises.Add(franchiseData);
foreach (var item in userData.Franchises)
{
item.Fees.Add(feeData);
}
db.Users.Add(userData);
db.SaveChanges();
//db.AddUserRole(userData.Id, 4);
result.Message = "Your franchisee has been created successfully..";
result.Status = true;
}
return result;
}
catch (Exception ex)
{
result.Message = "We are unable to process your request at this time. Please try again later.";
result.Status = false;
return result;
}
}
The error message is straightforward - your code is creating a new Franchise object but it never sets the franchiseData.UserId property.
Add this to your franchiseData population code before you call db.SaveChanges():
franchiseData.UserId = model.CurrentUserId;
BTW, you should add code verify that the current user has permission to set foreign-key reference properties (like UserId) directly from values read from submitted forms because otherwise any user could enter Id values belonging to other users and gain access to information they shouldn't have access to - or otherwise alter with your database.

Assigns me no mail after user creation - Does Logic Apps make a mistake?

This is the case, for example, if a user now creates a page. So the next day I need Azure Logic apps to send an email after 1 day.
The problem is: right now, it is by no means sending any email to me if I sign up yesterday. But it sends me an email that now it has gone through with succe.
I would like to know what goes wrong since it by no means email me as I set up yesterday.
My Logic app (From Azure) - Images
However, be aware that the code can be made short but I just need to find out if Logic apps are making mistakes or if thus my code previously works without problems.
[Route("/api/cronjob")]
[HttpGet]
public async Task<IActionResult> NewSletterUserEmail()
{
await Newsletter();
return Ok("Godkendt!");
}
public async Task<IActionResult> Newsletter()
{
var m = new Settings.ArdklarMail();
var dtt = DateTime.Now;
var days = _dbContext.OfferUser.Max(i => i.Days);
var MaxDays = DateTime.Now.AddDays(-days);
var userlist = _dbContext.Users.Where(i => i.Opretdate >= MaxDays && i.TilmeldtNyhedsbrev == true).ToList();
if (userlist != null)
{
foreach (var item in userlist)
{
string mail = item.Brugernavn;
string fullname = item.Navn;
var memberData = _dbContext.MemberShipValue.FirstOrDefault(r => r.UserId == item.UserId);
if (memberData == null)
{
//alm bruger
var result = _dbContext.OfferUser.Where(x => x.Value == 1).ToList();
if (result != null)
{
foreach (var itemValue in result)
{
int itemValueDays = itemValue.Days;//hvis den ingen antal har så giver den 0.
var daysValue = DateTime.Now.AddDays(-itemValueDays);
if (item.Opretdate.Date == daysValue)
{
var title = itemValue.Title;
var viewModel = new EmailModel
{
getUrl = m.RemoveLinkUrl(),
Title = title,
FullName = fullname,
Text = itemValue.Text.ToHtmlString()
};
var resultMail = await _viewRenderService.RenderToStringAsync("~/Views/Templates/OfferToUsers.cshtml", viewModel);//return Null here
MailMessageControl mailA = new MailMessageControl();
mailA.SetCredentials(m.azureName(), m.password());
mailA.SetSender(m.mailFrom());
mailA.AddAddressSee(item.Brugernavn);
mailA.SetSubject(title);
mailA.SetBody(resultMail);
mailA.SendEmail();
await Task.Delay(2200);
}
}
}
}
else
{
var result = _dbContext.OfferUser.Where(x => x.Value == 2).ToList();
if (result != null)
{
foreach (var itemValue in result)
{
int itemValueDays = itemValue.Days;//hvis den ingen antal har så giver den 0.
var daysValue = DateTime.Now.AddDays(-itemValueDays);
if (item.Opretdate.Date == daysValue)
{
var title = itemValue.Title;
var viewModel = new EmailModel
{
getUrl = m.RemoveLinkUrl(),
Title = title,
FullName = fullname,
Text = itemValue.Text.ToHtmlString()
};
var resultMail = await _viewRenderService.RenderToStringAsync("~/Views/Templates/OfferToUsers.cshtml", viewModel);//return Null here
MailMessageControl mailA = new MailMessageControl();
mailA.SetCredentials(m.azureName(), m.password());
mailA.SetSender(m.mailFrom());
mailA.AddAddressSee(item.Brugernavn);
mailA.SetSubject(title);
mailA.SetBody(resultMail);
mailA.SendEmail();
await Task.Delay(2200);
}
}
}
}
}
}
//Det er til dem fra nyhedsbrevet som få tilsendt nyhedsbrev omkring div ting.
var newsletterlist = _dbContext.NewsletterList.Where(i => i.Tilmeldtdato >= MaxDays).ToList();
if (newsletterlist != null)
{
foreach (var item in newsletterlist)
{
string mail = item.Email;
string fullname = item.Email;
//til de nyhedsbrevet område
var result = _dbContext.OfferUser.Where(x => x.Value == 3).ToList();
if (result != null)
{
foreach (var itemValue in result)
{
int itemValueDays = itemValue.Days;
var daysValue = DateTime.Now.AddDays(-itemValueDays);
if (item.Tilmeldtdato.Date == daysValue)
{
var title = itemValue.Title;
var viewModel = new EmailModel
{
getUrl = m.RemoveLinkUrl(),
Title = title,
FullName = fullname,
Text = itemValue.Text.ToHtmlString()
};
var resultMail = await _viewRenderService.RenderToStringAsync("~/Views/Templates/OfferToUsers.cshtml", viewModel);
MailMessageControl mailA = new MailMessageControl();
mailA.SetCredentials(m.azureName(), m.password());
mailA.SetSender(m.mailFrom());
mailA.AddAddressSee(mail);
mailA.SetSubject(title);
mailA.SetBody(resultMail);
mailA.SendEmail();
await Task.Delay(3500);
}
}
}
}
}
return Ok("Godkendt!");
}
No, I don't see mistake in Azure Logic Apps. Since the Logic App uses a recurrence trigger, it triggers the Logic App at the defined interval of time.
As there was send email action both side on the parallel branch, it will somehow send you an email by no means.

Unable to add more entries to Firebase after 11

I have a database in firebase that is meant to hold user data and I'm able to get it to add account data up to number 10 (zero based), but after that, anytime I call the function to add to the database it doesn't show up in Firebase. I am using this for a game in Unity. Here are the function calls.
`
public void populateDatabase()
{
//populate static account data
AccountData _thisAccount = new AccountData();
_thisAccount.accName = Account.instance.NickName();
_thisAccount.accEmail = PlayerAccount._this.getUserEmail();
_thisAccount.accCash = 100;
_thisAccount.accGem = 100;
//Ranking Values
_thisAccount.Rank = 0;
//rookie
_thisAccount.RookieRank = 0;
_thisAccount.RookieAverage = 0;
_thisAccount.RookieScoreOne = 0;
_thisAccount.RookieScoreTwo = 0;
_thisAccount.RookieScoreThree = 0;
//Amature
_thisAccount.AmatureRank = 0;
_thisAccount.AmatureAverage = 0;
_thisAccount.AmatureScoreOne = 0;
_thisAccount.AmatureScoreTwo = 0;
_thisAccount.AmatureScoreThree = 0;
//Semi
_thisAccount.SemiProRank = 0;
_thisAccount.SemiAverage = 0;
_thisAccount.SemiProScoreOne = 0;
_thisAccount.SemiProScoreTwo = 0;
_thisAccount.SemiProScoreThree = 0;
//Pro
_thisAccount.ProRank = 0;
_thisAccount.ProAverage = 0;
_thisAccount.ProScoreOne = 0;
_thisAccount.ProScoreTwo = 0;
_thisAccount.ProScoreThree = 0;
_thisAccount.accTricks = Account.instance.ReturnTricks();
string tName = _thisAccount.getAccName();
Debug.Log("Name: " + tName + " account " + _thisAccount.accTricks.Length);
Debug.Log("Email: " + _thisAccount.accEmail);
Debug.Log("Cash: " + _thisAccount.accCash);
Debug.Log("Attempt to fill Database info");
ConstuctDatabase(usersdb, _thisAccount);
}
private void ConstuctDatabase(DatabaseReference AccountRef, AccountData _thisAccount)
{
int num = 0;
AccountRef.RunTransaction(MutableData =>
{
num++;
List<object> account = MutableData.Value as List<object>;
if (account == null)
{
account = new List<object>();
}
else
{
Debug.Log("continue");
}
Dictionary<string, object> newAccount =
new Dictionary<string, object>();
newAccount["AccountName"] = _thisAccount.accName;
newAccount["AccountEmail"] = _thisAccount.accEmail;
newAccount["Cash"] = _thisAccount.accCash;
newAccount["Gem"] = _thisAccount.accGem;
//Ranking Values
newAccount["Rank"] = _thisAccount.Rank;
//rookie
newAccount["RookieRank"] = _thisAccount.RookieRank;
newAccount["RookieAverage"] = _thisAccount.RookieAverage;
newAccount["RookieScoreOne"] = _thisAccount.RookieScoreOne;
newAccount["RookieScoreTwo"] = _thisAccount.RookieScoreTwo;
newAccount["RookieScoreThree"] = _thisAccount.RookieScoreThree;
//Amature
newAccount["AmateurRank"] = _thisAccount.AmatureRank;
newAccount["AmateurAverage"] = _thisAccount.AmatureAverage;
newAccount["AmateurScoreOne"] = _thisAccount.AmatureScoreOne;
newAccount["AmateurScoreTwo"] = _thisAccount.AmatureScoreTwo;
newAccount["AmateurScoreThree"] = _thisAccount.AmatureScoreThree;
//Semi
newAccount["SemiProRank"] = _thisAccount.SemiProRank;
newAccount["SemiProAverage"] = _thisAccount.SemiAverage;
newAccount["SemiProScoreOne"] = _thisAccount.SemiProScoreOne;
newAccount["SemiProScoreTwo"] = _thisAccount.SemiProScoreTwo;
newAccount["SemiProScoreThree"] = _thisAccount.SemiProScoreThree;
//Pro
newAccount["ProRank"] = _thisAccount.ProRank;
newAccount["ProAverage"] = _thisAccount.ProAverage;
newAccount["ProScoreOne"] = _thisAccount.ProScoreOne;
newAccount["ProScoreTwo"] = _thisAccount.ProScoreTwo;
newAccount["ProScoreThree"] = _thisAccount.ProScoreThree;
//Trick Logic]
Dictionary<string, bool> newTricks =
new Dictionary<string, bool>();
int i = 0;
while (i < _thisAccount.accTricks.Length)
{
newTricks["Trick" + i] = _thisAccount.accTricks[i]._owned;
i++;
}
newAccount["TrickList"] = newTricks;
Debug.Log("ConstructDB1");
account.Add(newAccount);
MutableData.Value = account;
Debug.Log("ConstructDB2");
return TransactionResult.Success(MutableData);
});
}
`
Unfortunately, this is a known issue in 6.6.0. If you pay attention to the release page, I'd recommend upgrading as soon as possible.
Now an explanation of what's going on with a small workaround: an array is being serialized as effectively a dictionary with a numeric key. It's parsing numbers lexicographically (ex: it's doing some thing like 1, 10, 2, 3, 4, 5, 6...) and it breaks at 11. To work around this, rather than adding a list as you currently are, try serializing a dictionary with lexicographically ordered keys (ex: M001, M002, M003, &c). I know this isn't ideal, but it should unblock you for the time being!

Programatically retrieve data using iterator in oracle ADF Mobile

I want to read programatically data using iterator in ADF mobile. My code is :
try {
ValueExpression vex = AdfmfJavaUtilities.getValueExpression("#{bindings.WeatherDescriptionIterator}", Object.class);
AmxIteratorBinding iter = (AmxIteratorBinding)vex.getValue(AdfmfJavaUtilities.getAdfELContext());
GenericType row = null;
BasicIterator bIter = iter.getIterator();
iter.getIterator().first();
ArrayList employees = new ArrayList();
for(int i = 0; i < iter.getIterator().getTotalRowCount(); i++) {
row = (GenericType)iter.getCurrentRow();
String phone = "";
String email = "";
if(row.getAttribute("Description") != null)
phone = row.getAttribute("Description").toString();
if(row.getAttribute("WeatherID") != null)
email = row.getAttribute("WeatherID").toString();
setTempValue(phone + " " + email);
iter.getIterator().next();
}
}
catch(Exception e1) {
AdfException ex = new AdfException(""+e1.getLocalizedMessage(), AdfException.ERROR );
throw ex;
}
I get error :-> cant not find property bindings
the expression should be :
ValueExpression vex = AdfmfJavaUtilities.getValueExpression("#bindings.WeatherDescriptionIterator.iteratorBinding}", Object.class);

Resources