1

I have 3 form inside the screen which are

  1. Period form It display a period
  • (that table have a field 'aphid')
  1. Activity form It display the Activity Sequence and Description
  • (that table have a field 'actid')
  1. Week Form
  • I want to retrieve the value from this app_apWeek table using the key period form (app_apHead) and activity form(app_activity)

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

Desmond Sim
  • 211
  • 2
  • 19
  • Whats the error? – SeaDude Feb 22 '22 at 03:22
  • i try to modified the field you gave, it still cant get the 'value' of 20 after click in it. – Desmond Sim Feb 22 '22 at 04:14
  • It's difficult for me to tell what the issue is through screenshots alone. Some things to try: **1.** Hover over the blue error and determine what the actual error message is (my guess is "delegation warning"). Research this warning. **2.** Ensure the `app_apHead` and `app_activity` values within the `And` statement are the *control names* (Textbox, Combobox, etc.) from your app. They look like *table names*. – SeaDude Feb 22 '22 at 22:51

1 Answers1

3

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...

  • actID and aphID are INT data types in SQL and...
  • txtActID and txtAphID are Textbox controls in PowerApps

See it in action...

enter image description here

Things to remember:

  • Using a LookUp here will only bring back the first record even though more records may meet the criteria
  • Use the PowerApps Filter function instead if there are more than 1 record that meets the criteria
SeaDude
  • 3,725
  • 6
  • 31
  • 68
  • 1
    SeaDude perfectly answered your question. I don't see what your comment is adding to either the answer or your question? – Iona Varga Feb 22 '22 at 07:34
  • may be my question not that clear. he point me the way to retrieve whole set of record, but actually i wish is retreive the apwProgress field from app_apweek table, i not familiar the way using powerapp call SQL script~ – Desmond Sim Feb 22 '22 at 08:32
  • Thank you Iona-Varga! Its ok @Desmond-Sim, PowerApps issues can be difficult to explain (I have ~4 years experience working with them! It's taken me a long time to speak with clarity on these issues). I'd suggest you try to generalize the issue further and break it down into smaller chunks. Then come back **with a new question** and we can try to assist. – SeaDude Feb 22 '22 at 22:59
  • 1
    Thanks Seadude. I try using Gallery Method to retrieve the value, don't use Form field to retrieve successfully get the data. – Desmond Sim Mar 02 '22 at 04:40