Filter view content by data in text field I've created a text field on a custom content type. The text field is called "targetUser" on my content type "message". 

targetUser is meant to collect the uid of a user that a current app user is sending a message to. E.g. If user 1 is sending a message to user 7, the number "7" will post to the targetUser field.

I want to create a view that ONLY displays "messages" with the targetUser number that matches the logged in user's uid, so that they may ONLY see messages meant for them. 

I essentially want my view to say: "Only display messages with this user's uid in the field targetuser" - is this doable? Hope I explained this well enough.
targetUser is meant to collect the uid of a user that a current app
  user is sending a message to


IMO the better approach would be to make targetUser an entity reference field.


Download and install the Entity Reference module


In content type Message fields, add a new field with Entity Reference and a widget of Auto complete (tag style) 



For example: I named mine lalala (click picture below to enlarge)




For Target Type, select User 
Number of Values: Unlimited (as you could send a message to multiple users)




Then add or edit a message node and start typing user name, you will see the name in the drop down, select it and save.

Use a comma , to add other user account.

 

In your view


contextual filter of Logged in User id (uid)
add a relationship of lalala Referenced Entity


If not, try Referencing entity, but if my memory is correct it's Referenced



Result: you should get a view of all the nodes where the logged in user was referenced. 




  The autocomplete only allows by username, and not uid. E.g. posting 47
  into this field isn't allowed?


Create a new USER view. 

1) click on +Add

2) Select Entity Reference

3) Remove user:name and add user:uid

4) click on settings and checkmark uid (if you don't do this step, it won't let you save the view)



Go to your Content Type Messages manage fields and edit your entity reference field. 


At the bottom check mark ✓ Render Views filters as select list
Change to mode to View and select your view.





  Also, "logged in user id (uid)" isn't an option? Just (author) User:
  Uid ?


You will need to create a CONTENT view and then add:


Relationship of Referenced User
Now since you have a relationship User: Uid becomes available as contextual filter