Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m confused

Virtualization Passing Field value to setvalue

Okay so I have the following code that works somewhat but I am wondering how I can read a hidden field from the controller and have the value from the field set the label of the column.


public partial class SharedBusinessRules : TCFSOperations.Data.BusinessRules
{
public override bool SupportsVirtualization(string controllerName)
{
if (controllerName == "WeeklyScheduleItems")
return true;
else
return false;
}

public override void VirtualizeController(string controllerName,
XPathNavigator navigator, XmlNamespaceManager resolver)
{
if (controllerName == "WeeklyScheduleItems")
{
// Change "Sunday" label to "To the actual date for the week number"
XPathNavigator SundayLabel = navigator.SelectSingleNode("/c:dataController/c:fields/c:field[@name='Sunday']/@label", resolver);
if (SundayLabel != null)
SundayLabel.SetValue("Replace with Value from Field @SunDate");
}
}
}


I am unable to find a way to get the value of my field and pass it into the the SundayLabel.SetValue()
2 people have
this question
+1
Reply
  • Hi, to the other person who also is looking for a solution to this. Granted if the Dynamic Configuration would work with Touch UI we would not have to try and do the above with shared business rules and virtualization..

    Does anyone have a solution the the Dynamics Configuration and Touch UI?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hello,

    You can read field values and change the controller, overriding the function VirtualizeControllerConditionally

    Best regards,

    Roberto
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Roberto I still can not get it working.

    This is now what my code looks like but I am not getting any success with it. In fact this has broken my data view many to many (which should be displaying initials rather then EmployeeID)


    namespace TCFSOperations.Rules
    {
    public partial class SharedBusinessRules : TCFSOperations.Data.BusinessRules
    {
    public override bool VirtualizeControllerConditionally(string controllerName)
    {
    if (controllerName == "WeeklyScheduleItems")
    return true;
    else
    return false;
    }

    public override void VirtualizeController(string controllerName, XPathNavigator navigator, XmlNamespaceManager resolver)
    {
    if (controllerName == "WeeklyScheduleItems")
    {

    // Change "Sunday" label to "@SunDate" for all Users

    XPathNavigator SundayLabel = navigator.SelectSingleNode("/c:dataController/c:fields/c:field[@name='Sunday']/@label", resolver);
    if (SundayLabel != null)
    {
    object SunDate = SelectFieldValue("SunDate");
    SundayLabel.SetValue("Sun - " + (string)SunDate);

    }

    }

    }
    }
    }
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • I even tried the following line but not joiy


    NodeSet("view[@id='myschedulevlist']").SelectFields("Sun").Attr("label", "Sun: " +(string)SunDate);
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated