代码之家  ›  专栏  ›  技术社区  ›  mcgrailm

如何将FileMaker Pro中的分隔字段解析为新表

  •  2
  • mcgrailm  · 技术社区  · 15 年前

    我的FileMaker Pro数据库中有一个字段,其中包含用分号分隔的数据,因此我要做的是将该数据分离到一个新表中。如果有人能给我指个正确的方向那会有帮助的

    1 回复  |  直到 9 年前
        1
  •  3
  •   Mikhail Edoshin    15 年前

    一种方法是编写一个脚本,将文本分成几行(使用 GetValue() ),然后用分号分隔每一行( Substitute( $line, ";", "¶" ) 获取值()

    我会这样写:

    Go to Layout( My Table )
    Go to Record/Request/Page[ First ]
    # Loop over records
    Loop
        Set Variable[ $line, 1 ]
        # Loop over lines
        Loop
          Exit Loop If[ ValueCount( My Table::My Field ) < $line ]
          #
          # Get line values
          Set Variable[ $fields, 
              Substitute( GetValue( My Table::My Field, $line ), ";", "¶" ) ]
          # ...
          Go to Layout( My Target Table )
          New Record/Request
          Set Field[ My Target Table::Foo, GetValue( $fields, 1 ) ]
          Set Field[ My Target Table::Foo, GetValue( $fields, 2 ) ]
          Go to Layout( My Table )
          # 
          Set Variable[ $line, $line + 1 ] 
        End Loop
        Go to Record/Request/Page[ Next, Exit After Last ]
    End Loop
    Go to Layout( original layout )