on 2018 Oct 17 4:19 PM
Hello Friends,
Env-10.1 on hana.
I have a requirement to move data from one material to another (around 100 materials)
The destination material already has data posted to it. So I need to append the data of source material to the destination without overwriting it and clear the data posted at the source.
Material dimension has a "new_mtrl_code" property which will identify the destination material. For convenience "new_mtrl_code" of destination is the same as the ID.
I plan to pass the materials in a DM package prompt, which would be read by the script.
created a test script
*XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%
*XDIM_MEMBERSET MATERIAL= %MATERIAL_SET%
*SELECT(%NewMATERIAL%,"[NEW_MTRL_CODE]",MATERIAL,"[ID]=%MATERIAL_SET%")
*XDIM_ADDMEMBERSET MATERIAL= %NewMATERIAL%
*WHEN CATEGORY
*IS %CATEGORY_SET%
*REC(EXPRESSION = %VALUE%, MATERIAL= MATERIAL.NEW_MTRL_CODE) *ENDWHEN
*XDIM_MEMBERSET CATEGORY = %CATEGORY_SET% *
*XDIM_MEMBERSET MATERIAL= %MATERIAL_SET%
*WHEN MATERIAL *IS %MATERIAL_SET%
*REC(EXPRESSION = 0)
*ENDWHEN
Tested the script in UJKT, it worked well for one material, however I am not able to pass multiple materials in the data region of ujkt, it keeps throwing an error
UJA_ADMIN_ERROR:Invalid attribute name (XXXX) in dimension (Material). However I can pass multiple categories with a comma. Is it a limitation for user defined dimensions?
if I have to run this script for multiple materials, does it need a for loop or this logic will take care.
Thanks for your time
Ed.
Request clarification before answering.
Next time, please format your code with a code button, now it's close to unreadable!
The code:
*LOOKUP SameModelName
*DIM NEWMAT:MATERIAL=MATERIAL.NEW_MTRL_CODE //corrected
*ENDLOOKUP
*XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%
*XDIM_MEMBERSET MATERIAL= %MATERIAL_SET%
*WHEN CATEGORY
*IS *
*REC(EXPRESSION = %VALUE%+LOOKUP(NEWMAT), MATERIAL= MATERIAL.NEW_MTRL_CODE)
*REC(EXPRESSION = 0)
*ENDWHENyou don't need to maintain same code for new materials...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Vadim for your reply. I will make sure I will format the code (did not know notice the button)
I have updated the second line and it works well
*DIM NEWMAT:Material=Material.NEW_MTRL_CODE
when I ran your code in UJKT, i was able to pass multiple materials in the prompt using commas, my code above threw errors inUJKT as well as a regular DM package. It did not accept multiple materials to be passed with commas.
I was looking into this note, 2587285 - Script logic Error "Invalid attribute name() in dimension()"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 6 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.