0

I have two column in my Excel Table (DataSource) and I am trying to evaluate both columns. Column 1 contains data and Column 2 is empty as shown below. The default FormMode is Edit, which contains 2 textboxes titled as "Column 1" and "Column 2", with 1 button to see the collection (See Below Code). Before using If condition I wanted to check whether I can see my record for row 1. The dafault property for Column1 is set to Gallery2.Selected.Column1 and the default property for Column 2 is set to " ". I used below code to see whether the collection will return my record,unfortunately instead of returning my record I saw Empty table with my column names i.e Column1 and Column2 under View -> Collections. Not sure what is wrong with below code. The code should return expected output in View> Collections.

Any help is appreciated!

Data Source

enter image description here

Code:

ClearCollect(Test,LookUp(Table1,Column1=DataCardValue6.Text && Column2= " ")

Expected Output

enter image description here

Updated Code:

ClearCollect(Test,LookUp(Table1,Column1=DataCardValue6.Text && Column2= IsBlank(Trim(Column2Name))))
biggboss2019
  • 220
  • 3
  • 8
  • 30

1 Answers1

1

Use IsBlank and Trim to check for any empty or whitespace strings.

IsBlank(Trim(Column2))

Trim will remove any whitespace and IsBlank will return a true/false if the string is empty or not after the trim.

IsBlank

Trim

UPDATE: Check only for IsBlank where Column2 is evaluated, the way you wrote it it's checking if Column2 = bool which will have a type mismatch since it's checking a string vs a bool, change to this:

ClearCollect(Test,LookUp(Table1,Column1=DataCardValue6.Text && IsBlank(Trim(Column2))))
kshkarin
  • 574
  • 4
  • 9
  • Getting "Incompatible type. We Can't evaluate your formula because the value being compared in the formula aren't same type" warning. See above updated code. Thanks! – biggboss2019 Oct 09 '20 at 18:21
  • is the goal to have `LookUp` pull from the table only where `Column2` is empty? – kshkarin Oct 09 '20 at 18:23
  • The goal is to pull the record from Column1 let's say UID1 and also empty row from Column 2. This way I can use IF condition to update Column2 . if there exist a record for UID1 then column2 will be updated. Once update is done, then additional row will be appended for same UID1 in Column 2. – biggboss2019 Oct 09 '20 at 18:29
  • @biggboss2019 Updated the answer – kshkarin Oct 09 '20 at 18:34
  • Does it have to be "Column2 inside Trim ? IsBlank(Trim(Column2)). Since my DataSource is Excel Table I used DataCardValue.Text and that seemed to have worked. Just wanted to double check. If I used Column2 as my Column Name then it is returning me empty table. As mentioned in my post. – biggboss2019 Oct 09 '20 at 18:41
  • @biggboss2019 please edit the question and show what is the expected output – kshkarin Oct 09 '20 at 18:45
  • @biggboss2019 have you tried changing the condition to test if it's the DataCardValue6 issue? try `Column1="UID1"` – kshkarin Oct 09 '20 at 18:54