locked
compute into table from another RRS feed

  • Question

  • I am writing a C# Lightswithc application

    I have two tables

    "all members" (is the primary table)

    "active members"

    I want to import/compute  temporary data every time the priority "terminate" is == No. Terminate is a drop down selection with two choices "Yes" or "No".... here is what code I have so far but I cannot get the table to occupy.

    partial void Username_Compute(ref string result)
            {
                {
                    {
                        string stringtmp = null; //default string is null if nothing found

                        allmember getMedian = //creates a variable of type allmember table and finds the correct record
                       (
                            from item in this.DataWorkspace.ApplicationData.allmembers
                            where (item.terminated == "No")
                            select item
                        ).FirstOrDefault();

                        if (getMedian != null) //if record is found
                        {
                            stringtmp = getMedian.Username;
                        }

                        result = stringtmp;
                    }
                }
            }
        }

    Friday, August 9, 2013 1:54 AM

Answers

  • hi N00785019UNF,

    Right-click in solution explorer on your table and select "add query".


    paul van bladel

    • Marked as answer by Angie Xu Tuesday, August 20, 2013 5:21 AM
    Friday, August 9, 2013 7:59 AM

All replies

  • Why not create a table called Members and a query called ActiveMembers that filters based on the Terminated property? Then you don't need a computed property to get the username, because all terminated members are in the Members table.

    Justin Anderson, LightSwitch Development Team

    Friday, August 9, 2013 2:18 AM
    Moderator
  • Am I able to append a activeusersquery to a table in light switch? I am going to take the end temp result and need to append it to record changes in a variable that I am entitling "might." I will need to append it daily and sort by active users

    Friday, August 9, 2013 2:27 AM
  • hi N00785019UNF,

    Right-click in solution explorer on your table and select "add query".


    paul van bladel

    • Marked as answer by Angie Xu Tuesday, August 20, 2013 5:21 AM
    Friday, August 9, 2013 7:59 AM