CabMasterPro User Guide
In This Topic
    Editing Merge Lines
    In This Topic

    The typical use of ASCII Exporting from CabMasterPro is to make mass changes to a library. Export Editor caters for this by providing a Replace action, where you can set certain values of filtered export lines. To create a Replace action, click the "New Action" button and select "Edit lines by setting" from the Action list. All the filter lists are hidden except for the Field list, where you can select "Value" or "Formula". The other two options (Name and Context) are unavailable because editing them may make the lines invalid for importing into CabMasterPro.

    A replace action can be placed any where in a script just like a filter, but unlike filters the position makes a big difference. This is because a replacement acts on any lines which have not been filtered out by that point in the script. If you place it right at the top, every line in the export file will have its value or formula set to the specified value, even though those lines may get filtered out further down the script. Because of this, you should first filter down to the lines you want and then do any replacements.

    If you have a replace action that sets Value to "100mm" for example, then any filters below it that test the Value field will always find it equal to "100mm", because the export line has been modified by that point.

    Substitution Characters

    When editing a field, its often useful to modify the existing value of that field. For example, you may wish to wrap a function name around the formula field - i.e. you want "some formula" to become "MRound(some formula)". You couldn't just type this exact string into the new value text box because other lines may have some other formula. We need to be able to access the original value of the field when figuring out the new value. If you include the string "%0" (percent zero) in the new value, it will be replaced with the exact text of the original field from each export line. So the correct value to enter would be "MRound(%0)". There is another one of these parameter strings: "%Q", which gets replaced with the original value with extra quotes stripped off.

    Some examples to clarify:-

    Original Value Replacement String Resulting Value
    """DoorWidth + DoorGap""" "MRound("some formula")" "MRound("some formula")"
    """DoorWidth + DoorGap""" "MRound(%0)" "MRound("""DoorWidth + DoorGap""")"
    """DoorWidth + DoorGap""" "MRound(%Q)" "MRound(DoorWidth + DoorGap)"


    In the "Original Value" column, we have the value of the field as it was read from the export file. The "Replacement String" is the text that we type into Export Editor, and "Resulting Value" is what the field is set to in the output merge file.

    On the first line, we have entered a fixed string which doesn't correspond with the original value. The result is exactly the same as the replace value, except that it is not what we want. The second line is closer to the desired result, except the "%0" includes the exact input so we end up with the extra quote marks. The last example is what we want - the quotes are stripped off the input before it is included.

    Note that all three methods are valid, depending on whether you want to ignore the input or include it with or without quotes. This situation just happened to require the use of the "%Q" parameter.

    There is one last substitution which can be made, which is the "%V" parameter. Whereas the other two parameters used the existing value of the current field, "%V" always returns the contents of the Value field. This means you can edit the Formula field to contain the current value of the export line. Note that if you are modifying the Value field, the "%V" parameter acts the same as "%Q", because it also strips off quote marks.