How do you restrict a field to contain alphanumeric characters only?

博客给出了使用正则表达式限制字段输入的代码示例,可将其放入字段的输入验证公式中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

This is an example of code that uses regular expressions to limit a field's entry. Put this in a field's Input Validation formula:
 @If( @Matches(Serial_Num; "+{0-9}"); @Success;
 @Matches(Serial_Num; "+{a-zA-Z}"); @Success; 
@Do(@Prompt([OK]; 
"Invalid Serial Number"; 
"The Unit Serial Number contains an illegal character, probably a carriage return. Please remove the illegal character and save again."); 
@Return("")) )
As described in Restrict Access at the Data Row Level, this approach requires the database to contain the field you want to use for filtering. For this example, the data includes a reference table called People, which contains two columns: Region and Manager. Names in the Manager field match Tableau Cloud or Tableau Server user names, and we’ll use this field for filtering. You can follow along using the Superstore data that comes with Tableau Desktop, although the fields and values do not match exactly. Connect to the data and set up the user filter In Tableau Desktop, open the workbook and connect to the data you want to filter. In this example, we use a table called Orders. Double click the Orders table to open the join canvas. Add the reference table (People) with a left join. For this example, join on the field Region. On the worksheet, select Analysis > Create Calculated Field, and create the following field, named "User is a manager". USERNAME() = [Manager] This calculation returns TRUE if the user name of the person signed in to the server exists in the manager column of the People table. Add the User is a manager field to the Filters shelf. In the Filter dialog box, select True, and then click OK. This sets the filter so that only people who are managers can see the data in the view. If you are not listed in the Manager field, your view while authoring might appear as a blank canvas. See how the view looks to a particular person: in the lower-right, open the Filter as User menu, and select someone you know is a manager. Important: As with a manual user filter, you need to take steps to Secure user filters on published content. Filter a data source Rather than maintain user filters and special permissions on each published workbook, you can filter a data source, and then publish the data source to make it available as a shared, one-to-many resource for anyone who uses that data. This procedure builds from the dynamic-filter approach described in th
最新发布
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值