I had a client ask me last week how you can put a conditional statement around a Data Extension function, where if the Data Extension does not exist, then don't process the code within it. The AMPscript is used in an email.

There are many scenarios why you would want to do this. For example, perhaps the Data Extension has been deleted due to an assigned Data Retention Policy.

The following code...

```js
%%[
var @rows
set @rows = LookupRows('DE Name', 'Field', 'Value')
]%%

```

...returns the error:

> 
> The Data Extension name for a LookupRows function call is invalid. A Data Extension of this name does not exist
> 
> 
> 

You can't try counting the rows either. For example, the following code also returns the same error.

```js
%%[
if RowCount(LookupRows('DE Name', 'Field', 'Value')) == 0 then
/* do something */
endif
]%%

```

I thought that perhaps you could first use WSProxy or platform API functions to try and retrieve the External Key of the DE name, and if it returns a value, then you could set the DE name as a variable in an AMPscript DE function, but this isn't possible as you can't use WSProxy or platform API functions in a send context.

Is there a solution to this?