이 문서는 https://tiddlywiki.com/languages/ko-KR/에서 티들리위키의 정적 HTML 표현의 일부입니다

getindex Operator (Examples)

2023년 3월 25일 오후 4:35

[[$:/palettes/Vanilla]getindex[background]]
→ returns the value of property background of the DataTiddler $:/palettes/Vanilla

[all[shadows+tiddlers]tag[$:/tags/Palette]getindex[background]]
→ returns all background colors defined in any of the ColourPalettes (notice the duplicates in the resulting list)

Tip
If a data tiddler contains a property with an empty value, the empty string is not appended to the results.

[[ListopsData]getindex[DataIndex]]
→ the empty value of the property DataIndex in ListopsData is not returned by the getindex operator

[[ListopsData]has:index[DataIndex]] :map[getindex[DataIndex]]
→ also returns the empty string

The above example works by first checking if the input title has the property DataIndex and then using the Map Filter Run Prefix to replace the title with their value of that property. If the input tiddler does not have the property, an empty selection is returned. The subsequent Map Filter Run Prefix outputs an empty string when its run returns an empty selection (because the property is empty).

[[$:/palettes/Vanilla]indexes[]] :filter[[$:/palettes/Vanilla]getindex<currentTiddler>count[]compare:number:eq[0]]
→ returns those colors in $:/palettes/Vanilla which are defined, but have no value assigned

In the above example, count is used to check if getindex returns a result (i.e. the corresponding property has a value) or not.