powerappspowerapps-formulapowerapps-collectionpowerapps-selected-items

retrieve Value from SQL Table using powerapp


I have 3 form inside the screen which are

  1. Period form It display a period
  1. Activity form It display the Activity Sequence and Description
  1. Week Form

which select apwprogress from aphid ='some value' and actid ='somevalue'

sample code that can retrieve a value = select apwprogress from app_apweek where actID=235 and aphID =23

Summary : i want to retreive the apwProgress field from app_apweek table

I have some problem of retrieve value from multiple field. I am using Lookup but give an error on it.

LookUp(
    // Look for app_apWeek table
    app_apWeek,
    // Using apHead table(aphid) and activity table(actid) to look for the value
    app_apHead.aphID And app_activity.actID,
    // Replace the value to the textinput1 field
    TextInput1
    )

Progress Field value

SQL table value

SQL

I not sure which part is wrong. Can suggest to me a better way to retrieve value. Thanks

enter image description here

enter image description here


Solution

  • I'm a little confused as to what exactly you are trying to do, but this should get you there.

    Looking at the SQL statement...

    SELECT * FROM <table_name> WHERE <column1> = 235 AND <column2> = 23

    Here's one way to do this in PowerApps:

    LookUp(TEST_TABLE,                    //SELECT the first record
        And(                              //WHERE, AND
            actID = Value(txtActID.Text), //column1 = txtActID.Text as INT
            aphID = Value(txtAphID.Text)  //column = txtAphID.Text as INT
        )
    )
    

    Where...

    See it in action...

    enter image description here

    Things to remember: