Display custom message when Perspective Table has no data

I want to display a message when no data on table, something like below but it’s not working, plz let me know how to mention for table if nodata

if (LotId!="" or MatlAutoId!=None) and vtable==dataset[0x6]:
		self.props.emptyMessage.noData.text="No Data Found"
		self.props.emptyMessage.noData.icon.path=material/sentiment_very_dissatisfied
	else:
		pass

You cannot do this. If vtable is a dataset, you could do vtable.rowCount == 0

1 Like

You’ve posted the same question in multiple topics. Don’t do this. And this one dates back to well before Perspective existed. ):

3 Likes

I am sorry for that…I searched for the ans but not found anywhere so asked in other 3 places for help …I will not do this for next time .

@bkarabinchak.psi Thank you for your reply

I deleted my question from other 2 places :sweat_smile: :slight_smile:

This should probably be in its own topic as it doesn’t really fit the OP, if an admin can split it for us. :slight_smile:

Why does it need to be scripted, instead of just setting those two properties and be done?

EDIT: nvm, I just saw the new thread. I’ll continue over there.

1 Like

Thanks for your Reply!
By using noData prop, i can display the msg and icon as below: lot no. and matl name not entered here but the message still shows but it shouldn’t b

but I want to display the message only when lot no. or matl name is entered coz table data displays based on lot no./matl name so where I can trigger to perform that function ?

I would make a few custom properties on the table and bind with expressions.

  • an array with the different noData values you want. The attached examples has an extra one to remind the user to enter Lot and material. I copied and pasted it from the props section. :wink:

  • a value of the data row count
    len({this.props.data})

  • an index to pick which noData value you want to use (In my example I also added custom properties for lot and material, but you can bind those to where you enter them.

if({this.custom.MatlAutoId} = '' || {this.custom.LotId} = '', 
   2,
   if({this.custom.rowCount} = 0, 1,
      0
     ) 
  )

Then you can bind props.emptyMessage.noData to your custom message
property('this.custom.noDataMessages[' + {this.custom.noDataIndex} + '].noData')

test_table.zip (18.8 KB)

1 Like