02-21-2015 04:51 PM
//Get Annuity Type Checkboxes ContactFieldDescriptor AnnuityProdFD = null; AnnuityProdFD = Act.UI.ActApplication.Instance.ActFramework.Contacts.GetContactFieldDescriptor("CUST_ContactTable1_090144.CUST_ProdAnn_071358635", true); string AnnuityProdVal = AnnuityProdFD.GetValue(c).ToString(); '''''' I have a ForEach Activity creator here that uses the above code correctly c.Update(); Act.UI.ActApplication.Instance.RefreshLoadedViews(); AnnuityProdFD.SetValue(c, false);
I have successfully used the method to obtain the current status of a check box but trying to set it does not apear to work at all
ITs the same as your code but i cant get it to work
02-23-2015 05:33 AM
Your SetValue line needs to go before the c.Update call, like so...
AnnuityProdFD.SetValue(c, false); c.Update(); //Update view after all changes have been made and saved (i.e. after any loops) Act.UI.ActApplication.Instance.RefreshLoadedViews();
02-23-2015 12:41 PM
once you do the c.Update() does that zero out the variables the code is holding?? Hence why it does nothing??
Would a Act.UI.ActApplication.Instance.RefreshLoadedViews(); be a safer choice??
02-23-2015 12:52 PM - edited 02-23-2015 12:54 PM
I'm speaking for the typical .NET data setup (Data.Datatable, Data.Dataset, etc.), and based on the previous posts in this thread, it looks like ACT works the same way.
That is, when working with a contact in code, you are dealing with an in-memory copy. Any changes you make, won't be saved unless you do an update. Updating in straight .NET does accept the changes (a.k.a. saves them). I can't say for certain if ACT works the same way (I'm not familiar enough with the inner workings of ACT). The RefreshLoadedViews call is probably just telling ACT to update the UI with the most recent information from the database. It shouldn't have anything to do with actually saving the changes. Hopefully someone else with more experience/knowledge can correct and/or verify what I've stated.
Basically, you have 3 steps you want to do:
1) Make changes to the data (SetValue)
2) Save changes (Update)
3) Update UI to reflect those saved changes (RefreshLoadedViews)
These steps are pretty common across a lot of database driven applications.
Edit: Completed thoughts
02-23-2015 12:56 PM
02-23-2015 01:01 PM
02-23-2015 01:11 PM
02-23-2015 01:14 PM